This case study, I will be create enviroment in AWS usyng EC2, Security Groups, S3 and DynamoDB.
- Create dynamic EC2 Instances Ubuntu
- Add access SSH for Instances
- Create EC2 Instance in another region and usyng the same ssh key
- Create Bucket S3 and associate a Instance EC2
- Create Database Dynamodb
This link set a tutorial Create AWS Account
This link set a tutorial AWS CLI configure.
This link download Terraform CLI.
cd ~/.ssh
ssh-keygen
Enter file in which to save the key (/home/schacon/.ssh/id_rsa): terraform-aws
In AWS Console, access EC2 Service then in sidebar look for Key pair. Select Option> Import Key Pair.
cd ~/.ssh && cat terraform-aws.pub
Import yout public key. You need repeat this Step in each EC2 Service diferent region
In file .vars.example rename to vars.tf and set your config data.
Now, in terminal run command terraform plan
Run terraform apply
Access your EC2 instance and Connect.
This connect SSH example, in your terminal change to
ssh -i ~/.ssh/terraform-aws ubuntu@ec2-3-23-95-102.us-east-2.compute.amazonaws.com
( ͡❛ ͜ʖ ͡❛)
Result
Now run command terraform destroy if you don't, you're going to be in trouble. 💸💸💸💸