Amazon VPC Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 52: Line 52:
{{External|[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internetgateway.html AWS::EC2::InternetGateway]}}
{{External|[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internetgateway.html AWS::EC2::InternetGateway]}}
{{External|[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html AWS::EC2::VPCGatewayAttachment]}}
{{External|[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html AWS::EC2::VPCGatewayAttachment]}}


  Resources:
  Resources:
Line 63: Line 62:
           Value: infinity-igw
           Value: infinity-igw
   
   
    InternetGatewayVpcAttachment:
  InternetGatewayVpcAttachment:
      Type: AWS::EC2::VPCGatewayAttachment
    Type: AWS::EC2::VPCGatewayAttachment
      Properties:  
    Properties:  
          InternetGatewayId: !Ref InternetGateway
        InternetGatewayId: !Ref InternetGateway
          VpcId: !Ref VPC
        VpcId: !Ref VPC


Note that an internet gateway is not attached with an VPC after creation, an AWS::EC2::VPCGatewayAttachment resource must be created to attach the internet gateway to a VPC.
Note that an internet gateway is not attached with an VPC after creation, an AWS::EC2::VPCGatewayAttachment resource must be created to attach the internet gateway to a VPC.

Revision as of 00:13, 10 April 2019

Internal

Overview

VPC Operations

Create a VPC

Describe VPC

aws ec2 describe-vpcs --vpc-id <vpc-id>

Create a VPC with Amazon Console

VPC Console -> Your VPCs -> Create VPC:

Name tag: the name of the VPC

IPv4 CIDR block: 10.7.0.0/16

IPv6 CIDR block: No IPv6 CIDR Block

Tenancy: default

Create a VPC with CloudFormation

AWS::EC2::VPC
Resources:
  VPC:
    Type: AWS::EC2::VPC
    Properties: 
      CidrBlock: !Ref PrimaryIPAddressRange
      EnableDnsSupport: true
      EnableDnsHostnames: false
      InstanceTenancy: "default"
      Tags:
        - Key: "Name"
          Value: !Ref VPCName

Create a Subnet

Internet Gateway Operations

Describe an Internet Gateway

aws ec2 describe-internet-gateways [--internet-gateway-ids igw-0f8b5a9295a707d16]

Create an Internet Gateway

AWS::EC2::InternetGateway
AWS::EC2::VPCGatewayAttachment
Resources:

  InternetGateway:
    Type: AWS::EC2::InternetGateway
    Properties: 
      Tags:
        - Key: Name
          Value: infinity-igw

  InternetGatewayVpcAttachment:
    Type: AWS::EC2::VPCGatewayAttachment
    Properties: 
        InternetGatewayId: !Ref InternetGateway
        VpcId: !Ref VPC

Note that an internet gateway is not attached with an VPC after creation, an AWS::EC2::VPCGatewayAttachment resource must be created to attach the internet gateway to a VPC.

Create a NAT Gateway