AWS CLI for EC2
- AWS CLI Commands will be in the form of
aws service <command/action> --parameter1 value1 ... --parametern valuen
-
Refer Here for the command line reference of AWS CLI
-
Refer Here for the aws cli for ec2.
-
To work with AWS CLI Commands we need an IAM User Refer Here to create an IAM User
-
Create a user and make a note of access key id & secret access key
-
Now configure aws cli using
aws configureand enter region (code), access key and secret access key -
In AWS CLI the commands with prefix
- describe generally indicates get/select
-
Lets work with some describe commands
- Describing security groups Refer Here
-
The Result of any command will have a certain output structure as mentioned in documentation
- For the output structure of describe-security-groups Refer Here
-
We can filter for the specifics using JMES PATH
-
Refer Here for some of the commands explored
Creation Commands
-
In AWS CLI creation commands will generally be prefixed with create
-
Lets try to find a command to create an ec2 instance we need to use command run-instances Refer Here
-
While creating ec2 instance we provide
- AMI
- instance type
- security group
- key pair
- tags
-
Copy the AMI id of Amazon Linux 2
-
Refer Here for the cli commands to create and control the instances.
