AWS Classroomnotes 29/Jun/2022

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:
    Preview
    Preview
    Preview
  • CLI Approach:
    • Search google with aws vpc cli
      Preview
    • Now open the docs
      Preview
      Preview
    • To form aws cli aws ec2 create-vpc
  • 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"
            }
        ]
    }
}

Preview
Preview
* Now lets add one subnet (manual)
Preview
Preview
Preview
* From cmd line
Preview
* Note: Any AWS resource will not have name, rather it will have tags.
* Exercise: Go through JMES path tutorial Refer Here

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner