Creating high Availability Architecture with AWS CLI

Aakash Choudhary
4 min readJul 9, 2021

Hey Guys,

I am back with another blog, In this blog I am going to create a high available Architecture with AWS CLI ( Command Line Interface ).

In order to manage any resource over AWS cloud with CLI, you must have AWS cli installed on your base Operating System. If you don’t have that first install that. You can take the help of below link.

Now, when you have AWS cli available, we can move ahead. We will perform a specific task in different different steps. Task is something like this :

🔅 Create a key pair
🔅 Create a security group
🔅 Launch an instance using the above created key pair and security group.
🔅 Create an EBS volume of 1 GB.
🔅 The final step is to attach the above created EBS volume to the instance you created in the previous steps.

Step 1 : Login

You need to first login to AWS cli, Open Command prompt or terminal of your base OS. Run aws configure and give credentials.

Login

Step 2: Key Creation

You need to run aws ec2 create-key-pair --key-name your_key_name . Your output should come like this.

Key Creation.

You can see your key on AWS console as well.

Step 3: Security Group Creation

You need to run aws ec2 create-security-group --description sg-description --group-name your_sg_name and your output should look like this.

Security Group

You can see your key on AWS console as well.

Step 4: EC2 Instance Creation

You need to run aws ec2 run-instances — image-id ami-00bf4ae5a7909786c — count 1 — instance-type t2.micro — key-name blog-test — security-group-ids sg-0ebea40dc6545a9f6 — subnet-id subnet-99c8b7dcaws ec2 run-instances — image-id ami-00bf4ae5a7909786c — count 1 — instance-type t2.micro — key-name blog-test — security-group-ids sg-0ebea40dc6545a9f6 — subnet-id subnet-99c8b7d5 and your output should look like this. Your image-id , security-group-id, key-name etc. will be different.

You can see your key on AWS console as well.

Step 5: EBS Volume Creation

ou need to run aws ec2 create-volume --volume-type gp2 --size 1 --availability-zone ap-south-1b and your output should look like this.

You can see your key on AWS console as well.

Step 5: EBS Volume Attach to Instance

ou need to run aws ec2 attach-volume --instance-id i-039****2dc --volume-id vol-0c****006 --device /dev/sdb and your output should look like this.

You can see your key on AWS console as well.

As you can see our volume is attached with our instance.

I hope you like this blog, For next blog topic suggestions or queries you can DM me on LinkedIn. If you like this blog make sure you clap it.

Thank You

Signing off 🙌

--

--