🔅Create AWS Services using CLI🔅

Tushar Joshi
3 min readJul 23, 2021

TASK DESCRIPTION :

🔅 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

What is AWS ?

Amazon Web Services (AWS) is the world’s most comprehensive and broadly adopted cloud platform, offering over 175 fully featured services from data centers globally. Millions of customers — including the fastest-growing startups, largest enterprises, and leading government agencies — are using AWS to lower costs, become more agile, and innovate faster.

One of the Advantage :

Pay-as-you-go allows you to easily adapt to changing business needs without overcommitting budgets and improving your responsiveness to changes. With a pay-as-you-go model, you can adapt your business depending on need and not on forecasts, reducing the risk of over positioning or missing capacity.

Login into the aws via CLI commands

Creating an IAM user:

Download the .csv file to get all the credentials of the IAM user which will help us login through the AWS CLI.

AWS configure:

  1. Create a key pair :
C:\Users\hp>aws create-key-pair --key-name myprojectkey

2. Create a security group :

C:\Users\hp>aws create-security-group --group-name Security1 --description "Security1" --vpc-id vpc-b59370de

3. Configuring the security rule :

C:\Users\hp>aws ec2 authorize-security-group-ingress --group-id sg-08e55d1c6b7898612 --group-name Security1 --protocol tcp --port 22 --cidr 0.0.0.0/0

We have successfully created the ingress or inbound rule, having tcp protocol (SSH type)

4. Launching the instance through the key pair and security group created above

C:\Users\hp>aws ec2 run-instances --image-id ami-0e306788ff2473ccb --instance-type t2.micro --subnet-id subnet-d8b1b8b0 --security-group-ids sg-08e55d1c6b7898612--key-name myprojectkey --count 1

5. Creating an EBS volume :

C:\Users\hp>aws ec2 create-volume --availability-zone ap-south-1a --volume-type gp2 --size 1

6. Attaching the volume created :

C:\Users\hp>aws ec2 attach-volume --volume-id vol-0f640a6cc9c48c1ce --instance-id i-04a808b5c4b6e9317 --device /dev/sdf

🔅🔅 Thank You for reading 🔅🔅

🔅🔅 Keep learning keep sharing 🔅🔅

--

--

Tushar Joshi

MLOPS Intern at Linux World || MLOPS 🧠 || DEVOPS(🐳☸👩🏻‍🍳)|| Ansible || Kubernetes|| AWS || ML || DL || Data Science || Jenkins|| Docker || RedHat Linux ||