Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save sierra-tango-echo/ab99f35d9a48651cb32593c37c54d4ba to your computer and use it in GitHub Desktop.

Select an option

Save sierra-tango-echo/ab99f35d9a48651cb32593c37c54d4ba to your computer and use it in GitHub Desktop.
---
Description: 'Flight Domain Template'
Mappings:
RegionMap:
eu-west-1:
"AMI": "ami-d266dfab"
eu-west-2:
"AMI": "ami-c5f11ea2"
Resources:
FlightClusterNetwork:
Type: AWS::EC2::VPC
Properties:
CidrBlock: '10.10.0.0/16'
EnableDnsSupport: true
EnableDnsHostnames: true
Tags:
-
Key: 'Name'
Value: 'FlightCluster'
FlightClusterInternetGateway:
Type: AWS::EC2::InternetGateway
DependsOn: FlightClusterNetwork
Properties:
Tags:
-
Key: 'Name'
Value: 'FlightCluster'
FlightClusterInternetGatewayAttachment:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
InternetGatewayId: !Ref FlightClusterInternetGateway
VpcId: !Ref FlightClusterNetwork
FlightClusterRouteTable:
Type: AWS::EC2::RouteTable
DependsOn: FlightClusterInternetGatewayAttachment
Properties:
VpcId: !Ref FlightClusterNetwork
Tags:
-
Key: 'Name'
Value: 'FlightCluster'
FlightClusterPrvSubnet:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: '10.10.0.0/24'
VpcId: !Ref FlightClusterNetwork
AvailabilityZone: !Select
- 0
- Fn::GetAZs: !Ref 'AWS::Region'
Tags:
-
Key: 'Name'
Value: 'FlightCluster'
PrvSubnetRouteTableAssocation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
SubnetId: !Ref FlightClusterPrvSubnet
RouteTableId: !Ref FlightClusterRouteTable
FlightClusterRouteInternetGateway:
Type: AWS::EC2::Route
DependsOn: FlightClusterInternetGatewayAttachment
Properties:
RouteTableId: !Ref FlightClusterRouteTable
DestinationCidrBlock: '0.0.0.0/0'
GatewayId: !Ref FlightClusterInternetGateway
FlightClusterSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupName: FlightCluster
GroupDescription: 'Primary SG for FlightCluster'
VpcId: !Ref FlightClusterNetwork
SecurityGroupIngress:
-
IpProtocol: '-1'
FromPort: 0
ToPort: 65535
CidrIp: '10.10.0.0/16'
Description: 'Allow all traffic for cluster VPC'
-
IpProtocol: 'tcp'
FromPort: 22
ToPort: 22
CidrIp: '213.83.69.6/32'
Description: 'Allow inbound SSH access'
-
IpProtocol: 'icmp'
FromPort: '8'
ToPort: '-1'
CidrIp: '0.0.0.0/0'
Description: 'Allow ping'
SecurityGroupEgress:
-
IpProtocol: '-1'
FromPort: 0
ToPort: 65535
CidrIp: '0.0.0.0/0'
Description: 'Allow outbound internet access'
Tags:
-
Key: 'Name'
Value: 'FlightCluster'
node01PriInterface:
Type: AWS::EC2::NetworkInterface
Properties:
SourceDestCheck: false
GroupSet:
- !Ref node01SecurityGroup
PrivateIpAddress: 10.10.0.100
SubnetId: !Ref FlightClusterPrvSubnet
Tags:
-
Key: 'Name'
Value: 'FlightCluster'
node01:
Type: AWS::EC2::Instance
Properties:
AvailabilityZone: !Select
- 0
- Fn::GetAZs: !Ref 'AWS::Region'
ImageId: !FindInMap ["RegionMap", !Ref "AWS::Region", "AMI"]
InstanceType: t2.small
Monitoring: true
KeyName: aws_ireland
NetworkInterfaces:
-
NetworkInterfaceId: !Ref node01PriInterface
DeviceIndex: 0
Tags:
-
Key: 'Name'
Value: 'FlightCluster'
UserData:
Fn::Base64:
Fn::Join:
- ''
- - "#cloud-config\n"
- "hostname: FlightCluster\n"
- "fqdn: <%=node.config.networks.pri.hostname%>\n"
- "runcmd:\n"
- " - curl <%= node.config.nodescripturl %> | /bin/bash -x | tee /tmp/mainscript-default-output\n"
node01publicIp:
Type: AWS::EC2::EIP
Properties:
Domain: vpc
node01publicIpAssociation:
Type: AWS::EC2::EIPAssociation
Properties:
NetworkInterfaceId: !Ref node01PriInterface
AllocationId: !GetAtt node01publicIp.AllocationID
Outputs:
domaincloudID:
Description: domaincloudID
Value: !Ref FlightClusterPriNetwork
PrvcloudID:
Description: PrvcloudID
Value: !Ref FlightClusterPrbSubnet
node01IP:
Description: node01IP
Value: !Ref node01publicIp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment