Tech Stack used in this project: Elastic Load Balancing, Amazon EC2, Auto Scaling Group, Amazon SNS, and Amazon Virtual Private Cloud.
In this lab, we will learn how to deploy a highly available infrastructure on AWS using Terraform, a popular infrastructure as code tool.
You can explore more at here
To do this lab, you will need to install Visual Studio Code, AWS CLI and Terraform on your local machine.
You should have an AWS account, which has an IAM user with Administrative permission.
After installing Visual Studio Code successfully, you can download an extension for Terraform called HashiCorp Terraform.
You can check if the Terraform is installed on your local machine by opening terminal and typing terraform version
You can check if the AWS CLI is installed on your local machine by opening terminal and typing aws --version
.
Next, You will need to create an Access keys. Following these step below to create an Access keys.
- Click on your AWS account and it will appears a tab. Choose Security credentials.
- Scroll down, you will see an Access keys interface. Click on Create access key.
- In the Create access key interface, choose Third party service.
- Then, check the square box. Choose Next.
- Click on Create access key
- Click on Download .csv file and Done.
-
Open the .csv file. You will see it has an access key and a secret key.
-
Open the terminal and type
aws configure
. You will see some things appear in the terminal.
- Configure like below:
- AWS Access Key ID: Assign your access key
- AWS Secret Access Key : Assign your secret access key
- Default region name: Enter
ap-southeast-1
- Default output format: Enter
json
Here, we need to create a key pair. We can then use this key pair to SSH into our EC2 instances.
About keypair_name, access AWS Management Console and search for EC2 (Remember change your region to Singapore) then click on Key Pairs.
- Click on Create key pair
Configure like below.
After creating key pair successfully, you will see a notification.
- First, clone this repository.
- HTTPS
git clone https://github.com/thnbao22/Demo-WorkshopAWS-Using-Terraform.git
- SSH
git clone git@github.com:thnbao22/Demo-WorkshopAWS-Using-Terraform.git
- After cloning this repository, please open the project in Visual Studio Code and navigate to the
terraform
folder using thecd
command on the terminal of Visual Studio Code
- Let's begin by initializing your Terraform workspace. Running the following command in the terminal.
terraform init
- Now, we need to validate our configuration. Use the following command in the terminal to do so.
- Apply the configuration now with the terraform apply command.
- Enter
yes
so terraform can provision infrastructure.
Now, you can follow the workshop to explore more.