Launch EC2 instance using CLI(Command Line interface)
AWS(Amazon Web Service):-
Amazon Web Services (AWS) is a on-demand cloud computing platforms and APIs to individuals, companies, and governments, on a metered pay-as-you-go basis. These cloud computing web services provide a variety of basic abstract technical infrastructure and distributed computing building blocks and tools.
AWS provide many services like EC2,EBS,EKS,VPC etc..........
In this artical we discuss EC2 service using CLI(Command Line Interface).
EC2(Amazon Elastic Compute cloud):-
EC2 encourages scalable deployment of applications by providing a web service through which a user can boot an Amazon Machine Image (AMI) to configure a virtual machine, which Amazon calls an "instance", containing any software desired. A user can create, launch, and terminate server-instances as needed, paying by the second for active servers – hence the term "elastic".
->EC2 provide boot able Image, use to launch operating systems.
->EC2 provide Compute infrastructure like RAM and CPU.
AWS(Amazon web service) provide 3 way to communicate with the clients like WebUi, CLI and programming way to communicate with AWS.
In this artical we learn how to communicate AWS using CLI commands.
Installing AWS Commands:-
Follow the below URL install the AWS command on the Redhat 8,https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html
Check the AWS command install in my system or not, run the command
aws --version
Above command show the AWS command successfully install in my systems.
Run AWS command show the option what we do using AWS commands.
aws
Configure AWS system using secret key and access key..............................
aws configure
Above command use to login the AWS , IAM(Identity access management) user account,IAM service provide to create a user and give the Admin and power user access to use service of AWS clouds.
Find information about instances:-
aws ec2 descibe-instances
Run this command find the information about all instances stopped and running status of the instances.............
describe-instance -> show all the current status of EC2 dashboards.show how many instances in the running and stopped.
Start EC2 instance using AWS commands:-
aws ec2 start-instances --instance-ids "EC2 instance ID"
This command use start the EC2 instance using instance id and start ec2 instance.
Above diagram show the status of running commands.
Launch Ec2 instance using CLI(Command line Interfaces):-
Requirements of launch EC2 instances.............
aws ec2 run-instances --image-id ami-0e306788ff2473ccb --instance-type t2.micro --subnet-id subnet-90b882f8 --count 1 --security-group-ids sg-0261a80ac31a91c30 --key-name arthhadoop1122
Use CLI concepts launch Ec2 instance, above figure show the launching status of EC2 instances.
Solve one use case using CLI(Command Line Interface) concepts...........
Task descriptions..............
Step1:-Create a key pair
step2:-Create a security group
step3:- Launch an instance using the above created key pair and security group.
step4:- Create an EBS volume of 1 GB.
step5:-The final step is to attach the above created EBS volume to the instance you created in the previous steps.
Solutions of use case...................
Step1:- Create a key pair using CLI(Command line Interface) concepts.....
aws ec2 create-key-pair --key-name arthkey
Step1 to solve how to create key pair, Key pair use give the password of the instance.
step2:-Create a security group use CLI(Command line interface) concepts.
aws ec2 create-security-group --group-name MysecurityGroup --description "My security group"
Step2 use to create security groups.
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 --subnet-id subnet-90b882f8 --count 1 --security-group-ids sg-0c07ac51a9a23a376 --key-name arthkey
Use step1 and step2 create step3 and launch ec2 instance.
step4:- Create an EBS volume of 1 GB using CLI(Command line Interface) concepts.
aws ec2 create-volume --availability-zone ap-south-1a --volume-type gp2 --size 10
In this step create EBS volumes..............
step5:-The final step is to attach the above created EBS volume to the instance you created in the previous steps.
aws ec2 attach-volume --volume-id vol-033ddb83195b01c53 --instance-id i-091cace16629819b8 --device /dev/sdf
Summary:-
In this artical we learn how to use CLI(Command line Interface) and launch EC2 interface and mount EBS storage with EC2 instance.
Thanks vimal Daga sir Give high level and advance idea to use Command line interface and launch services and learn more new concepts about AWS clouds.