The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line.

If you decide to use Amazon AWS cloud for your project then the first thing you need is to install Amazon CLI (Command Line Interface) to start automating your basic Amazon AWS operations or you can go for terraform.

AWS CLI provides command and we can use this commands to automate them through scripts.

Let’s create Infrastructure using CLI:

⭐Create a security group and add a rule with port 22 [SSH]

⭐Launch an instance using the above created key pair and security group.

⭐Create an EBS volume of 1 GB.

⭐ Attach the above created EBS volume to the instance you created in the previous steps.

Let’s get started with Setup

Step 1: Setup Amazon AWS CLI:

Here, make sure you have selected Programmatic access because it gives you an access key and a secret key required to work with CLI.

Set Permission

Here we have to give the administrator Access so in the future we won’t face any access issue. Except for billing Dashboard, we have access to all services with administrator access power.

Download Amazon AWS Access Key and Secret Access Key

Go To: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html, download and install the AWS CLI Program.

How to check if Amazon CLI is installed successfully?

that’s it we have successfully installed AWS CLI Version 2

Configure AWS CLI

Here, we have successfully done with the configuration.

Let’s get started with Infrastructure

step 1: Create a key pair

we have to save with special format as we can see this key material come with

NewLine(\n)

for this, we need to process this key.

Step 2: Create a security group and add a rule with port 22 [SSH]

You can check/verify the security group from the command line and also from Web-UI

Check From CLI, this command list out all security group.

aws ec2 describe-security-groups

WebUI:

When we create a security group from CLI, it comes with empty inbound traffic rules.

To add rule

aws ec2 authorize-security-group-ingress --group-name CLI --protocol tcp --port 22 --cidr 0.0.0.0/0

Step3: Launch an instance using the above created key pair and security group.

aws ec2 run-instances --image-id ami-0e306788ff2473ccb --instance-type t2.micro --key-name Hadoop --security-group-ids sg-0d1d5e82788ce8dbc --subnet-id subnet-c0646da8 --count 1

Step4: Create an EBS volume of 1 GB.

Volume

Step 5: Attach the above created EBS volume to the instance created in the previous steps.

Instance Description.

now, we can connect to the instance using SSH as we have already updated the security group with port 22.

completed with the TASK.

THANK YOU FOR READING!!😀😇

Aspiring Cloud DevOps Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store