Terraform official doc https://registry.terraform.io/providers/hashicorp/aws/latest/docs
- Launch Amazon-Linux instance
- install terraform --> https://developer.hashicorp.com/terraform/downloads
- install ansible
yum install ansible
- install aws-cli and setup the credentials for IAM user
aws --version
aws configure
aws configure list
- copy the terraform-AL2-launch folder into the master instance
cd terraform-AL2-launch
- execute below command to get neccessary dependancies for provider to run terraform script
terraform init
- check terraform syntax
terraform plan
- Create resources present in terraform script
terraform apply / terraform apply -auto-approve
- Destroy created resources
terraform destroy
we have manually created secret key to ssh into the slave instance. This needs to be copied to master instance so that master can access slave
- Enable PasswordbasedAuthentication in master instance
- command to copy the pem file from local to master instance
scp Server-Key-Pair.pem [email protected]:/root
- connect to master instance & move Server-Key-Pair.pem to .ssh folder
mv Server-Key-Pair.pem .ssh