AWS CLI
- AWS has command line interface using AWS CLI
- To work with CLI we need IAM Programmatic Access (Secret Access key Id & Secret Access Key)
- AWS CLI is used to automate the aws infra creation & management with the help of shell scripts or powershell
- AWS CLI: Refer Here for the official docs
aws [options] <command> <subcommand> [parameters]
How to work with cli
- CLI works with id’s
Exploration-1: Create a VPC (virtual network) in mumbai
- Manual steps:
- CLI Approach:
- Search google with
aws vpc cli
- Now open the docs
- To form aws cli
aws ec2 create-vpc
- Search google with
- Command:
aws ec2 create-vpc `
--cidr-block "10.0.0.0/16" `
--tag-specifications "ResourceType=vpc,Tags=[{Key=Name,Value=fromcli}]"
### output
{
"Vpc": {
"CidrBlock": "10.0.0.0/16",
"DhcpOptionsId": "dopt-da183fa2",
"State": "pending",
"VpcId": "vpc-0c198c1a8182f440d",
"OwnerId": "678879106782",
"InstanceTenancy": "default",
"Ipv6CidrBlockAssociationSet": [],
"CidrBlockAssociationSet": [
{
"AssociationId": "vpc-cidr-assoc-0ebe69be5e5e4fc1c",
"CidrBlock": "10.0.0.0/16",
"CidrBlockState": {
"State": "associated"
}
}
],
"IsDefault": false,
"Tags": [
{
"Key": "Name",
"Value": "fromcli"
}
]
}
}
* Now lets add one subnet (manual)
* From cmd line
* Note: Any AWS resource will not have name, rather it will have tags.
* Exercise: Go through JMES path tutorial Refer Here