Basic VPC

Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into vpc for more info or structure used).

There are public, private, subnets, and NAT Gateways created in each availability zone.

Create env.tfvars

Before to execute terraform move env.tfvars.sample to env.tfvars

Usage

To run this example you need to execute:

$ terraform init
$ terraform plan -var-file=env.tfvars
$ terraform apply -var-file=env.tfvars

For Destroy this recipe execute

$ terraform destroy -var-file=env.tfvars

Requirements

Name Version
terraform >= 1.0
aws >= 4.35

Providers

Name Version
aws >= 4.35

Inputs

Create em env.tfvars for execute this recipe, this contains key value.

Key Description
aws_account_id Set Account id AWS
vpc_cidr_block Define Cidr for vpc AWS
aws_region Define region AWS

For Connection instance execute this commands in output terraform

Connecttion in public ec2

$ ssh -i <KEY_PAIR>.pem ubuntu@<PUBLIC IP>

Connecttion in private ec2

Berofe executre tunnel in public-ec2/bastion

$ ssh -L 8080:<PRIVATE-IP-DESTINY-INSTANCE>:22 -i <KEY_PAIR>.pem ubuntu@<PUBLIC-IP-BASTIONS>

After Tunnel OK execute ssh

$ ssh -i <KEY_PAIR>.pem -p 8080 ubuntu@127.0.0.1