Skip to content

Instantly share code, notes, and snippets.

@iam-j
Created April 17, 2022 06:51
Show Gist options
  • Save iam-j/9f20795093061aedb1763f692e34be5a to your computer and use it in GitHub Desktop.
Save iam-j/9f20795093061aedb1763f692e34be5a to your computer and use it in GitHub Desktop.
AWSTemplateFormatVersion: '2010-09-09'
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: Networking
Parameters:
- VPC
- InternalSubnets
- TargetSecurityGroup
ParameterLabels:
InternalSubnets:
default: Internal subnets *
TargetSecurityGroup:
default: SG for the instances and RDS *
VPC:
default: VPC *
Parameters:
InternalSubnets:
ConstraintDescription: Must be a list of two or more Subnet ID's within the selected
VPC.
Description: Subnets (two or more) where your cluster nodes and other internal
infrastructure will be deployed. MUST be within the selected VPC. Specify the
ExternalSubnets again here if you wish to deploy the whole stack into the same
subnets.
Type: List<AWS::EC2::Subnet::Id>
TargetSecurityGroup:
ConstraintDescription: A security group ID beginning with sg-
Description: The security group ID into which to put the EC2 and RDS instances
Type: AWS::EC2::SecurityGroup::Id
VPC:
ConstraintDescription: Must be the ID of a VPC.
Description: Virtual Private Cloud
Type: AWS::EC2::VPC::Id
Resources:
InternalLoadBalancer:
Properties:
ConnectionDrainingPolicy:
Enabled: true
Timeout: 300
ConnectionSettings:
IdleTimeout: 3600
HealthCheck:
HealthyThreshold: '2'
Interval: '30'
Target: HTTP:80/SamplePage.php
Timeout: '29'
UnhealthyThreshold: '2'
Instances: ['i-0b43ca35b6d2076ef']
Listeners:
- InstancePort: '80'
InstanceProtocol: HTTP
LoadBalancerPort: '80'
Protocol: HTTP
Scheme: internet-facing
SecurityGroups:
- Ref: TargetSecurityGroup
Subnets:
Ref: InternalSubnets
Type: AWS::ElasticLoadBalancing::LoadBalancer
Outputs:
URL:
Description: The URL of the Sample App
Value:
Fn::Join:
- ''
-
- http
- ://
- Fn::GetAtt:
- InternalLoadBalancer
- DNSName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment