“Building an AWS complete infrastructure with terraform and ansible”
A guide to create scalable AWS environment with help of terraform and ansible along with deploying wordpress site.Few things to be considered before starting e.g:sound knowledge on aws ,linux,terraform.
Preview:
Resources:
- Route 53 hosted zones -2(private,public)
- VPC -1
- Availability Zones -2
- Subnets -7(2 ELB,2 ASG,3RDS)
- Route Tables -2(1Public,1 Private)
- Security Groups -4(1RDS,1 ASG,1 Dev instance,1 ELB)
- VPC S3 Endpoint
- Internet Gateway
- S3 Code Bucket
Process Flow:
Deployment Steps:
- Update version / Install Python on your local machine.
#apt install python-pip
2. Download and install terraform.
#curl -O https://releases.hashicorp.com/terraform/0.11.2/terraform_0.11.2_linux_amd64.zip
3. Install AWS Cli
#pip install awscli — upgrade
4. Add repo of Ansible and install ansible
#apt-add-repository ppa:ansible/ansible
#apt-get install ansible
5. ssh-keygen setup
6. AWS User setup
Go to AWS console,select IAM>add user>select access type- programmatic access>permission>attach existing policies already>select Administration>click review>click create user
Download the .csv file.
7. Domain set up.
Go to AWS console>Route53>Register domain
or
If you have already a domain or want to buy from outside ,then go to hosted zone and create a record set.
8. Create Delegation Set
On local machine,
#aws route53 create-reusable-delegation-set — caller-reference
Make a note of above output and copy name servers, go to aws console>registered domain/hosted zones,select the domain
Add or edit name server>paste the copied name servers.
9. Please go through below git link and copy the terraform and ansible codes for deployment.
https://github.com/bhusanlab/TERRAWS
Good Luck
Bhusan