Last active
May 10, 2022 23:58
-
-
Save kmansoft/39f7be10553195f41b8201e5638073f2 to your computer and use it in GitHub Desktop.
An attempt at two network interfaces per EC2 node - results in an error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: '2010-09-09' | |
Description: 'Test - simple 2 network interfaces' | |
Parameters: | |
KeyName: | |
Description: 'Key Pair name' | |
Type: 'AWS::EC2::KeyPair::KeyName' | |
Default: kman | |
Resources: | |
VPC: | |
Type: 'AWS::EC2::VPC' | |
Properties: | |
CidrBlock: '30.0.0.0/16' | |
EnableDnsSupport: true | |
EnableDnsHostnames: true | |
Tags: | |
- Key: Name | |
Value: 'simple' | |
SubnetPublic: | |
Type: 'AWS::EC2::Subnet' | |
Properties: | |
AvailabilityZone: !Select [0, !GetAZs ''] | |
CidrBlock: '30.0.1.0/24' | |
VpcId: !Ref VPC | |
Tags: | |
- Key: Name | |
Value: 'simple - public' | |
SubnetPrivate: | |
Type: 'AWS::EC2::Subnet' | |
Properties: | |
AvailabilityZone: !Select [0, !GetAZs ''] | |
CidrBlock: '30.0.2.0/24' | |
VpcId: !Ref VPC | |
Tags: | |
- Key: Name | |
Value: 'simple - private' | |
InternetGateway: | |
Type: 'AWS::EC2::InternetGateway' | |
Properties: | |
Tags: | |
- Key: Name | |
Value: 'simple' | |
VPCGatewayAttachment: | |
Type: 'AWS::EC2::VPCGatewayAttachment' | |
Properties: | |
VpcId: !Ref VPC | |
InternetGatewayId: !Ref InternetGateway | |
RouteTablePublic: | |
Type: 'AWS::EC2::RouteTable' | |
Properties: | |
VpcId: !Ref VPC | |
Tags: | |
- Key: Name | |
Value: 'simple' | |
RouteTableAssociation: | |
Type: 'AWS::EC2::SubnetRouteTableAssociation' | |
Properties: | |
SubnetId: !Ref SubnetPublic | |
RouteTableId: !Ref RouteTablePublic | |
RouteToInternet: | |
Type: 'AWS::EC2::Route' | |
Properties: | |
RouteTableId: !Ref RouteTablePublic | |
DestinationCidrBlock: '0.0.0.0/0' | |
GatewayId: !Ref InternetGateway | |
DependsOn: VPCGatewayAttachment | |
SecurityGroup: | |
Type: 'AWS::EC2::SecurityGroup' | |
Properties: | |
GroupDescription: 'Allow SSH and ping' | |
VpcId: !Ref VPC | |
SecurityGroupIngress: | |
- IpProtocol: tcp | |
FromPort: 22 | |
ToPort: 22 | |
CidrIp: '0.0.0.0/0' | |
- IpProtocol: icmp | |
FromPort: -1 | |
ToPort: -1 | |
CidrIp: '0.0.0.0/0' | |
Tags: | |
- Key: Name | |
Value: 'simple' | |
Host1: | |
Type: 'AWS::EC2::Instance' | |
Properties: | |
ImageId: 'ami-02541b8af977f6cdd' # Amazon Linux x86 | |
InstanceType: 't2.micro' | |
KeyName: !Ref KeyName | |
NetworkInterfaces: | |
- SubnetId: !Ref SubnetPublic | |
AssociatePublicIpAddress: true | |
DeleteOnTermination: true | |
DeviceIndex: '0' | |
GroupSet: | |
- !Ref SecurityGroup | |
- SubnetId: !Ref SubnetPrivate | |
AssociatePublicIpAddress: false | |
DeleteOnTermination: true | |
DeviceIndex: '1' | |
GroupSet: | |
- !Ref SecurityGroup | |
Tags: | |
- Key: Name | |
Value: 'simple - host1' | |
Host2: | |
Type: 'AWS::EC2::Instance' | |
Properties: | |
ImageId: 'ami-02541b8af977f6cdd' # Amazon Linux x86 | |
InstanceType: 't2.micro' | |
KeyName: !Ref KeyName | |
NetworkInterfaces: | |
- SubnetId: !Ref SubnetPublic | |
AssociatePublicIpAddress: true | |
DeleteOnTermination: true | |
DeviceIndex: '0' | |
GroupSet: | |
- !Ref SecurityGroup | |
- SubnetId: !Ref SubnetPrivate | |
AssociatePublicIpAddress: false | |
DeleteOnTermination: true | |
DeviceIndex: '1' | |
GroupSet: | |
- !Ref SecurityGroup | |
Tags: | |
- Key: Name | |
Value: 'simple - host2' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment