Skip to content

Instantly share code, notes, and snippets.

@sbennettmcleish
Last active March 19, 2018 09:56
Show Gist options
  • Select an option

  • Save sbennettmcleish/5acc9553710c2463c3b7a0cecaa00a83 to your computer and use it in GitHub Desktop.

Select an option

Save sbennettmcleish/5acc9553710c2463c3b7a0cecaa00a83 to your computer and use it in GitHub Desktop.
Cloudformation Cidr function
SubnetExtA:
Type: AWS::EC2::Subnet
DependsOn: VpcCidrBlockIpv6
Properties:
CidrBlock:
!Select: [0, !Cidr [ !Ref "VpcCidr", "256", "8" ]]
Ipv6CidrBlock:
!Select: [0, !Cidr [ !Select [ 0, !GetAtt ["VPC", "Ipv6CiderBlocks"], "256", "64" ]]]
AssignIpv6AddressOnCreation: "true"
AvailabilityZone: !Join [ "", [ !Ref "AWS::Region", "a" ]]
Tags:
-
Key: Name
Value: !Join [ "-", [ !Ref "AWS::StackName", "Ext" ]]
VpcId: !Ref VPC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment