Automatic deployment and management of EC2 instances using Terraform.
-
What? This is a Terraform module to construct, deploy and manage EC2 instances.
-
Why? Any application that requires a dedicated server can make use of this module.
-
How? This module creates a single EC2 instance. The instance type and dimensions are configurable.
The stack created by this terraform module is composed of:
- Compute
- EC2 instance
- Network
- Virtual Private Cloud
- Internet Gateway
- Security Group
- Route table
- Subnet
Name | Description | Type | Default | Required |
---|---|---|---|---|
aws-profile | The name of the AWS shared credentials account. | string | aws-profile |
yes |
aws-region | The AWS region | string | aws-region |
yes |
iam-role-name | The IAM role to assign to the instance | string | role-name |
no |
ig-tag-name | The name to apply to the Internet gateway tag | string | aws-ig-created-with-terraform |
no |
instance-ami | The AMI (Amazon Machine Image) that identifies the instance | string | ami-01419b804382064e4 |
no |
instance-associate-public-ip | Defines if the EC2 instance has a public IP address. | string | true |
no |
instance-key-name | The name of the SSH key to associate to the instance. Note that the key must exist already. | string | engagement-key |
no |
instance-tag-name | instance-tag-name | string | EC2-instance-created-with-terraform |
no |
instance-type | The instance type to be used | string | t2.micro |
no |
sg-tag-name | The Name to apply to the security group | string | SG-created-with-terraform |
no |
subnet-cidr-block | The CIDR block to associate to the subnet | string | 10.0.1.0/24 |
no |
subnet-tag-name | The Name to apply to the VPN | string | VPN-created-with-terraform |
no |
user-data-script | The filepath to the user-data script, that is executed upon spinning up the instance | string | "" | no |
vpc-cidr-block | The CIDR block to associate to the VPC | string | 10.0.0.0/16 |
no |
vpc-tag-name | The Name to apply to the VPC | string | VPC-created-with-terraform |
no |
Name | Description |
---|---|
instance-id | The EC2 instance ID |
instance-public-dns | The EC2 instance public DNS |
- Improve documentation
- terraform resource aws_instance
- terraform VPC
- terraform subnet
- aws explains VPCs and subnets
- aws explains internet gateway
- terraform security groups
- terraform route table
- stack question with good explanation about vpc peering here
- good resource explaining teraform vpc and subnet creation here