Aws services using CLI

Aws(amazon web services) provides cloud computing services to the user .
In today’s world cloud computing is best for every startup companies and other companies which want to provide effective services to the customer without spending heavy amount for buying physical devices for computing power.
In Aws many services are available for computing power EC2 service is used . Using EC2 service instance is launched which have OS installed, which is installed using AMI(amazon machine image).
AMI(amazon machine image) is provided by AWS ,which is used to install OS .Many AMIs are available for EC2 instance .
For launch of EC2 instance at Aws , many resources are used
After select AMI for launching EC2 instance it is necessary to select the Aws instance type , in different instance type different amount of memory and cpu is available . For installation of OS, storage is necessary . Security group is also added to the instance for decide the traffic , Key pair is added to the instance for remote logging.
For create security group using CLI use the below cmd
aws ec2 create-security-group --group-name MySecurityGroup --description "this is my trial security group" --vpc-id vpc-db19f9b0

For create key pair run below cmd
aws ec2 create-key-pair --key-name MyKeyPair

For launch the instance using above created security group and key pair run below cmd
aws ec2 run-instances --image-id ami-0e306788ff2473ccb --instance-type t2.micro --count 1 --subnet-id subnet-4fdbd227 --security-group-ids sg-01a843810eeae4b01 --key-name MyKeyPair

For create volume in ebs service of Aws run below cmd
aws ec2 create-volume --availability-zone ap-south-1a --size 1 --volume-type gp2 --tag-specifications ResourceType="volume",Tags=[{key="name",value="MyVolume"}]

After create , it is necessary to attach the volume to instance for use the storage to store data. For attach volume to the instance run below cmd
aws ec2 attach-volume --instance-id i-01c80f4b8be909ea5 --volume-id vol-0dd0132a6e4f0ccef --device "/dev/sdh"
