Managing basic AWS services using CLI

Managing basic AWS services using CLI

In this article, I will be introducing you AWS CLI program to interact with AWS services using the command line interface. Its helpful in lots of customization & automation processes. The WebUI or the console of AWS does not fulfill the custom usages of its users. The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, we can control multiple AWS services from the command line and automate them through scripts.

I will be performing the following operations using the CLI with the help of AWS CLI tool:-

🔷Creating a key pair to connect to our EC2 instance

aws ec2 create-key-pair --key-name anyname
No alt text provided for this image

Verifying from Dashboard

No alt text provided for this image

🔷Creating a security group that acts as firewall for our instance

aws ec2 create-security-group --group-name anygroupname --description "Give Description" --vpc-id your_vpc_id

No alt text provided for this image

Verifying from Dashboard

No alt text provided for this image

🔷Adding rules to our security group to allow incoming traffic for SSH

aws ec2 authorize-security-group-ingress --group-name anygroupname --protocol tcp --port 22 --cidr 0.0.0.0/0
No alt text provided for this image

Verifying from Dashboard

No alt text provided for this image

🔷Launching an instance using the same above created key pair and security group

aws ec2 run-instances --image-id id_of_image_that_u_want_to_use --instance-type type_of_instance --security-group-ids sg_id --subnet-id subnet_id --count number_of_instances_to_launch --key-name key_created

No alt text provided for this image
No alt text provided for this image

Verifying from Dashboard

No alt text provided for this image

🔷Creating an EBS volume

aws ec2 create-volume --size size_of_disk_in_gb --volume-type gp2 --availability-zone zone_id
No alt text provided for this image

Verifying from Dashboard

No alt text provided for this image

🔷Attaching the above created volume to the instance launched

aws ec2 attach-volume --volume-id id_of_volume_created --instance-id id_of_instance_to_attach --device /dev/sdf
No alt text provided for this image

Verifying from Dashboard

No alt text provided for this image
No alt text provided for this image

Thus, I have successfully performed our desired operations using AWS CLI.

Thanks!!!

To view or add a comment, sign in

More articles by Rahul Yadav

Insights from the community

Others also viewed

Explore topics