[go: up one dir, main page]

0% found this document useful (0 votes)
23 views3 pages

Create Ec2 Using AWS CLI

commands of ec2 create using cli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views3 pages

Create Ec2 Using AWS CLI

commands of ec2 create using cli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

 Create Ec2 using AWS CLI.

Open command prompt in your laptop OR open AWS CLI ( cloudshell ).

 aws configure
 Copy Access key from Aws account and paste
 Copy secret Access key from AWS account and paste
 ap-south-1
 json

 To know region
 aws ec2 describe-region

 To check availability zones


 aws ec2 describe-availability-zones

 For images
 aws ec2 describe-images

 copy the any AMI id to create ec2


 Q ( for quite)

 To create a key pair


 aws ec2 create-key-pair --key-name ( key12)

 To create security group


 aws ec2 create-security-group --group-name ( mysecurity)
--description “HTTP and SSH Allowed” -- vpc ( )

 To allow traffic
 aws ec2 authorize-security-group-ingress --group-id (
) -- protocol tcp --port=22 --cidr 0.0.0.0/0

 To allow muti protocol


 aws ec2 authorize-security-group-ingress --group-id (
) -- protocol tcp --port=22 --cidr 0.0.0.0/0 , --portocol tcp
--port=80 --cidr 0.0.0.0/0

 To create Ec2 with default security group


 aws ec2 run-instances --image-id ( ami ----) --instance-type
t2.micro --key-name ( )

 To create Ec2 with security group


 aws ec2 run-instances --image-id ( ami ----) --instance-type
t2.micro --key-name ( ) --security-group-ids ( )

 To name the instance ( tagging)


 aws ec2 create-tags --resources ( instance id ) –tags
Key=Name, Value=Server

 To check all VPC


 aws ec2 describe-vpcs

 To check VPCS in regions.


 aws ec2 describe-vpcs --region ( as-east-1)

 To check volume ( current instance )


 aws ec2 describe-volumes --volume-ids ( )

 To change volume ( add volume , size )


 aws ec2 modify- volume –size (13 ) --volume-id ( )

 To check volume modifications


 aws ec2 describe-volumes-modifications --volume-ids ( )

 To reboot instance ( restart)


 aws ec2 reboot-instances --instance-ids ( )

 To stop instance
 aws ec2 stop-instances --instance-ids ( )

 To check instance details


 aws ec2 describe- instances --instance-ids ( )

 To check instance status


 aws ec2 describe-instance-status –instance-ids ( )

 To terminate instance
 aws ec2 terminate-instance --instance-ids ( )

 To delete key pair


 aws ec2 delete-key-pair --key-name ( )

 To delete security group


 aws ec2 delete-security-group

 To create volume
 aws ec2 -volume --volume-type gp2 --size 18 –availability-
zone ap-south-1a
 To attach volume
 aws ec2 attach-volume --volume-id (vol----) --instance-id ( i ----)
--device /dev/sdb
 To detach volume
 aws ec2 detach-volume --volume-id (vol----) --instance-id ( i ----)
 To delete volume
 aws ec2 delete-volume --volume-id (vol----)
 To create snapshot
 aws ec2 create-snapshot --volume-id (vol----)

You might also like