WORKING ON AWS CLI
ABOUT AWS CLI
THE AWS COMMAND LINE INTERFACE (CLI) is tool to manage aws services. AWS provide the storage and functionally to improve our business scale and grow. we launch the instance without using WEBUI.
AWS CLI support a wide range of terminal program in command prompt like bash, zsh, tchs, window cmd window power shell and lots of as well.
INSTALLING AWS CLI IN ANY OPERATING SYSTEM
We need to install the software awscli
https://awscli.amazonaws.com/AWSCLIV2.msi download this software
To check awscli install or not in cmd
aws --version
get access key and secret key from IAM ->user->power access
After installation we have to need configure our cli using
- access key -> its like user id but not same
- secret key-> its like a password
- default region name ->ap-south-1
- default output formate-> json
aws configure
Need to create access key key pair
aws ec2 create-key-pair --key-name arth_task
if we want to check in webui then aws->key-pair
if we have already key-pair then this command has to be used
aws ec2 describe-key-pair
Now we need to security group in ec2 instance
aws ec2 create-security-group --description "arth_task_security" --group-name arth_task
in awscli
aws ec2 describe-security-groups --group-id sg-0cfd652eecdab47e4
check on webui
Let's launch the ec2 instances we use above security group
aws ec2 describe-instances
launch ec2 instances
aws ec2 run-instances --image-id ami-052c08d70def0ac62 --instance-type t2.micro --count 1 --subnet-id subnet-6a272e02 --security-group-ids sg-024b9fb54a114d605 --key-name arth_task
now check instance launch or not in webui
If we want to stop the instances the this command is to be used
aws ec2 stop-instances --instances-ids INSTANCE ID
CREATE EBS VOLUME USING AWSCLI
If we need the ebs volume we have to need availability zone or data center and volume type
aws ec2 create-volume --availability-zone ap-south-1a --size 1
check on webui create ebs volume or not
Attaching ebs volume with ec2 instances
aws ec2 attach-volume --device xvdb --instance-id i-0c26836d88df63079 --volume-id vol-002d40d9942517222
check on webui
If we want to disconnect the ebs volume
aws ec2 detach-volume -volume-id Volume-ID
THANK YOU(in brief) about awscli
Great work