??AWS CLI COMMANDS??
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.
Let's start by knowing what exactly is Cloud Computing and AWS services?
Cloud computing is the on-demand availability of?computer system resources, especially data storage (cloud storage) and?computing power, without direct active management by the user.?The term is generally used to describe?data centers?available to many users over the?Internet.
Large clouds, predominant today, often have functions?distributed over multiple locations from central?servers. If the connection to the user is relatively close, it may be designated an?edge server.
Clouds may be limited to a single?organization?(enterprise clouds), or be available to multiple organizations (public cloud).
Amazon Web Services (AWS)?is a secure cloud services platform, offering compute power, database storage, content delivery and other functionality to help businesses scale and grow.
In simple?words AWS allows you to do the following things-
Before we proceed to the CLI Commands, let's proceed to creating IAM User for configuring AWS CLI.
Go to the IAM user service. Then, click on "Add User" and remember to give Programmatic Access and AWS Management Console access .
Then after proceeding to next in Permissions give PowerUserAccess and then finally create the user.
Now after the successful creation, don't forget to copy the Access Key and the Secret Key.
Now after that open your command prompt and run the command: aws configure
Now, after the successful configuration; let's start with creating the key pair.
CLI COMMAND:- aws ec2 create-key-pair --key-name TASK2
Now, let's create a security group.
CLI COMMAND:- aws ec2 create-security-group --group-name MySecurityGroup -- description "My security group" --vpc-id vpc-fe30da95
领英推荐
We have created the security group but ingress or inbound rules are not being created so we need to create these rules.?
CONFIGURING THE SECURITY GROUP:-
CLI COMMAND:- aws ec2 authorize-security-group-ingress --group-id sg-04b33f8f53a9485ab --group-name MySecurityGroup --protocol tcp --port 22 --cidr 0.0.0.0/0
NOW WE ARE READY TO LAUNCH THE INSTANCES
CLI COMMAND:- aws ec2 run-instances --image-id ami-00bf4ae5a7909786c --instance-type t2.micro --subnet-id subnet-de3d2eb6 --security-group-ids sg-04b33f8f53a9485ab --key-name TASK2 --count 1
Now, let's create an EBS Volume of 1GB
CLI COMMAND:- aws ec2 create-volume --availability-zone ap-south-1a --volume-type gp2 --size 1
Now, let's attach them to our newly launched instance
CLI COMMAND:- aws ec2 attach-volume --volume-id vol-071a1e3740f11161d --instance-id i-0518fac336783722a --device /dev/sdf
DETACHING THE VOLUME CREATED
CLI COMMAND:- aws ec2 detach-volume --device /dev/sdf --instance-id i-0518fac336783722a --volume-id vol-071a1e3740f11161d
TERMINATE THE INSTANCE CREATING.
CLI COMMAND:- aws ec2 terminate-instances --instance-id i-0518fac336783722a
TASK COMPLETED
executive at Rolta India Limited
3 年Very Good