Before to execute terraform, you should change the env.tfvars
inputs.
To run this example you need to execute:
$ terraform init
$ terraform plan -var-file=env.tfvars
$ terraform apply -var-file=env.tfvars
To destroy the resources you need to execute:
$ terraform destroy -var-file=env.tfvars
To connect to the EC2 public instance, use the following command:
ssh -i <output_key_name>.pem ubuntu@<output_ec2_public_ip>
To connect to the EC2 private instance using AWS EC2 Instance Connect, use the following command:
ssh -i <output_key_name>.pem ubuntu@<output_ec2_private_id> -o ProxyCommand='aws ec2-instance-connect open-tunnel --instance-id <output_ec2_private_id> --region us-east-1 --profile <profile>'
Name | Version |
---|---|
aws | 5.21.0 |
Name | Source | Version |
---|---|---|
ec2_private | ./ec2 | n/a |
ec2_public | ./ec2 | n/a |
keypair | ./keypair | n/a |
vpc | ./vpc | n/a |
Name | Type |
---|---|
aws_ec2_instance_connect_endpoint.this | resource |
aws_ami.ubuntu | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
aws_profile | Environment variable to specify a named profile | string |
"poc" |
no |
aws_region | AWS Region | string |
"us-east-1" |
no |
instance_type | Instance type to use for the instance. | string |
"t3.micro" |
no |
key_name | Keypair name | string |
"key-teste" |
no |
name | common name of resources | string |
"teste" |
no |
private_subnets_cidrBlock | The IPv4 CIDR block for the Private Subnet | string |
"172.23.0.0/24" |
no |
public_subnets_cidrBlock | The IPv4 CIDR block for the Public Subnet | string |
"172.23.1.0/24" |
no |
tags | A mapping of tags | map(string) |
{} |
no |
vpc_cidrBlock | The IPv4 CIDR block for the VPC | string |
"172.23.0.0/23" |
no |
vpn_name | VPC Name | string |
n/a | yes |
Name | Description |
---|---|
ec2_private_id | n/a |
ec2_private_ip | n/a |
ec2_public_ip | n/a |
key_name | n/a |