Showing posts with label AWS VPC. Show all posts
Showing posts with label AWS VPC. Show all posts

Tuesday, 21 September 2021

AWS Networking - Part V: Create Subnet Using AWS Console

When we have created a new VPC, we can start adding subnets to it. We are going to create two subnets. Subnet 10.10.0.0/24 is a Public Subnet in Availability Zone eu-west2c, where we later add an Internet GW. Subnet 10.10.0.0/24 is a Private Subnet in Availability Zone eu-west2a that will use a NAT GW for uni-directional Internet access.


Figure 1-18: VPC Route Table: Routes.

Monday, 20 September 2021

AWS Networking - Part III: VPC Verification Using AWS CLI

 

VPC Verification Using AWS CLI


We can verify our VPC configuration by using AWS CLI. Example 1-1 shows the output for command aws ec2 describe-vpc in JSON format. This command lists all our VPC resources with their properties. The first one is the newest VPC NVKT-VPC-01, and the second one is the default VPC which I have named DFLT-VPC. The first VPC gets ordinal zero [0], and the second VPC gets number one [1]. Note that ordinal numbers are not shown in the output. VPC properties describe the VPC-specific CIDR Block, DHCP Options, VPC Identifier, Owner Id, CIDR Block Association, and Tags.

 

aws ec2 describe-vpcs

{

    "Vpcs": [

        {

            "CidrBlock": "10.10.0.0/16",

            "DhcpOptionsId": "dopt-09217361",

            "State": "available",

            "VpcId": "vpc-04ef72cc79a73f82e",

            "OwnerId": "123456654321",

            "InstanceTenancy": "default",

            "CidrBlockAssociationSet": [

                {

                    "AssociationId": "vpc-cidr-assoc-0379c0e3e854f43ff",

                    "CidrBlock": "10.10.0.0/16",

                    "CidrBlockState": {

                        "State": "associated"

                    }

                }

            ],

            "IsDefault": false,

            "Tags": [

                {

                    "Key": "Name",

                    "Value": "NVKT-VPC-01"

                }

            ]

        },

        {

            "CidrBlock": "172.31.0.0/16",

            "DhcpOptionsId": "dopt-09217361",

            "State": "available",

            "VpcId": "vpc-cfbac1a7",

            "OwnerId": "123456654321",

            "InstanceTenancy": "default",

            "CidrBlockAssociationSet": [

                {

                    "AssociationId": "vpc-cidr-assoc-89d487e1",

                    "CidrBlock": "172.31.0.0/16",

                    "CidrBlockState": {

                        "State": "associated"

                    }

                }

            ],

            "IsDefault": true,

            "Tags": [

                {

                    "Key": "Name",

                    "Value": "DFLT-VPC"

                }

            ]

        }

    ]

Example 1-1: AWS CLI: Retrieve VPC Information.


We can use filters for retrieving information only from some specific resources. The command aws ec2 describe-vpcs --filters Name=tag:Name,Values=NVKT-VPC-01 shows VPCs where we have attached the Key/Value pair Name/NVKT-VPC-01.

 

aws ec2 describe-vpcs --filters Name=tag:Name,Values=NVKT-VPC-01

{

    "Vpcs": [

        {

            "CidrBlock": "10.10.0.0/16",

            "DhcpOptionsId": "dopt-09217361",

            "State": "available",

            "VpcId": "vpc-04ef72cc79a73f82e",

            "OwnerId": "123456654321",

            "InstanceTenancy": "default",

            "CidrBlockAssociationSet": [

                {

                    "AssociationId": "vpc-cidr-assoc-0379c0e3e854f43ff",

                    "CidrBlock": "10.10.0.0/16",

                    "CidrBlockState": {

                        "State": "associated"

                    }

                }

            ],

            "IsDefault": false,

            "Tags": [

                {

                    "Key": "Name",

                    "Value": "NVKT-VPC-01"

                }

            ]

        }

    ]

}

Example 1-2: AWS CLI: Retrieve VPC Information.


We can also query resource-specific information using the command aws ec2 describe-vpcs --query "Vpcs[0]". The zero within square brackets after the resource Vpcs identifies the ordinal number of a resource. In our example, VPC NVKT-VPC-01 is the first one, and it has an ordinal number zero.

 

aws ec2 describe-vpcs --query "Vpcs[0]"

{

    "CidrBlock": "10.10.0.0/16",

    "DhcpOptionsId": "dopt-09217361",

    "State": "available",

    "VpcId": "vpc-04ef72cc79a73f82e",

    "OwnerId": "123456654321",

    "InstanceTenancy": "default",

    "CidrBlockAssociationSet": [

        {

            "AssociationId": "vpc-cidr-assoc-0379c0e3e854f43ff",

            "CidrBlock": "10.10.0.0/16",

            "CidrBlockState": {

                "State": "associated"

            }

        }

    ],

    "IsDefault": false,

    "Tags": [

        {

            "Key": "Name",

            "Value": "NVKT-VPC-01"

        }

    ]

}

Example 1-3: AWS CLI: Retrieve VPC Information.


If we want to see only some specific resource properties, we can add the properties after the resource, separated by a dot. Example 1-4 shows how we can see the CIDR Block Association for VPC NVKT-VPC-01 (ordinal zero).

 

aws ec2 describe-vpcs --query "Vpcs[0].CidrBlockAssociationSet"

[

    {

        "AssociationId": "vpc-cidr-assoc-0379c0e3e854f43ff",

        "CidrBlock": "10.10.0.0/16",

        "CidrBlockState": {

            "State": "associated"

        }

    }

]

Example 1-4: AWS CLI: Retrieve CIDR (Properties) Association to VPC (Resource).


We can change the output representation from the JSON to table by using the option --output table. The table output is a good choice when we create documentation about VPCs. Note that you can use this option with all other commands too.

 

aws ec2 describe-vpcs --query "Vpcs[0].CidrBlockAssociationSet" --output table

 

------------------------------------------------------

|                    DescribeVpcs                    |

+-----------------------------------+----------------+

|           AssociationId           |   CidrBlock    |

+-----------------------------------+----------------+

|  vpc-cidr-assoc-0379c0e3e854f43ff |  10.10.0.0/16  |

+-----------------------------------+----------------+

||                  CidrBlockState                  ||

|+------------------+-------------------------------+|

||  State           |  associated                   ||

|+------------------+-------------------------------+|

 

Example 1-5: AWS CLI: Retrieve CIDR Association to VPC – Table Output.

AWS Networking - Part II: Create VPC - AWS Console

The first thing to do when we create a VPC is to log in to the AWS console. Then we select the AWS Region where we want to launch our VPC. We are going to use VPC Region Europe (London) eu-west-2. As the last step, we give the name to VPC and associate a CIDR block 10.10.0.0/16 to it.

Figure 1-3: Virtual Private Cloud (VPC) – Example VPC.

Wednesday, 25 March 2020

Comparing Internet Connection used in AWS and LISP Based Networks


Forewords

This post starts by discussing the Internet connection from the AWS VPC Control Plane operation perspective. The public AWS documentation only describes the basic components, such as an  Internet Gateway (IGW) and a subnet specific Implicit Routers. However, the public AWS documentation does not describe the Control Plane operation related to distributing the default route from IGWs to IMRs. The AWS VPC Control Plane part in this post is based on my assumptions, so be critical of what you read. The second part of this post shortly explains the Control-Plane operation of the Internet connection used in LISP based network. By comparing the AWS VPC to LISP based network I just want to point out that even though some might think that cloud-based networking is much simple than traditional on-premise networking, it is not. People tend to trust network solutions used in clouds (AWS, Azure, etc.) and there is no debate about (a) what hardware is used, (b) how the redundancy works, (c),  are solutions standard-based and so on. Now it is more like, I do not care how it works as long as it works. Good or bad, I do not know.