Home > Software design >  Template contains errors.: Template format error: YAML not well-formed. (line 30, column 9) that is
Template contains errors.: Template format error: YAML not well-formed. (line 30, column 9) that is

Time:10-16

AWSTemplateFormatVersion: 2010-09-09
Description: VPC, Subnets and EC2
Resources:
  MyVpc:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: 192.168.0.0/16
      EnableDnsHostnames: true
      Tags:
         -
           Key: Stack
           Value: Test
  MyVpcRouteTable:
    Type: AWS::EC2::RouteTable
    Properties:
      VpcId: !Ref MyVpc
  MyInternetGateway:
    Type: AWS::EC2::InternetGateway
    Properties:
      Tags:
         -
            Key: Stack
            Name: Test
  AddInternetGatewayToVpc:
    Type: AWS::EC2::VPCGatewayAttachment
    Properties:
      InternetGatewayId: !Ref MyInternetGateway
      VpcId: !Ref MyVpc
  AddInternetGatewayRouteToRouteTable
      Type: AWS::EC2::Route
      Properties:
        GatewayId: !Ref MyInternetGateway
        DestinationCidrBlock: 0.0.0.0/0
        RouteTableId: !Ref MyVpcRouteTable
  PublicSubnet:
    Type: AWS::EC2::Subnet
    Properties:
      VpcId: !Ref MyVpc
      CidrBlock: 192.168.1.0/24
      MapPublicIpOnLaunch: true
      AvailabilityZoneId: euw1-az2
  PrivateSubnet:
    Type: AWS::EC2::Subnet
    Properties:
      VpcId: !Ref MyVpc
      CidrBlock: 192.168.2.0/24
      MapPublicIpOnLaunch: false
      AvailabilityZoneId: euw1-az2
  WebserverInstance:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: ami-0ea0f26a6d50850c5
      InstanceType: t2.micro
      SubnetId: !Ref PublicSubnet
      KeyName: !Ref MyInstanceKeyPair
  MyInstanceKeyPair:
    Type: AWS::EC2::KeyPair
    Properties:
      KeyName: MyKeyPair

CodePudding user response:

You are missing : after AddInternetGatewayRouteToRouteTable. So it should be:

AddInternetGatewayRouteToRouteTable:
  • Related