Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpbarto/68db5e0a5f3da584763d7cecf076af62 to your computer and use it in GitHub Desktop.
Save jpbarto/68db5e0a5f3da584763d7cecf076af62 to your computer and use it in GitHub Desktop.
AWSTemplateFormatVersion: '2010-09-09'
Description: >
A sample ElasticBeanstalk cloudformation template that deploys a 2 (MinSize) cluster of PHP servers
behind an application load balancer listening on both port 80 and 8080. The ALB is placed (ideally)
into a set of public subnets with the PHP servers in private subnets.
Parameters:
ec2Subnets:
Type: List<AWS::EC2::Subnet::Id>
Description: Subnets for PHP servers
albSubnets:
Type: List<AWS::EC2::Subnet::Id>
Description: Subnets for application load balancers
Resources:
sampleApplication:
Type: AWS::ElasticBeanstalk::Application
Properties:
Description: AWS Elastic Beanstalk Sample Application
sampleApplicationVersion:
Type: AWS::ElasticBeanstalk::ApplicationVersion
Properties:
ApplicationName:
Ref: sampleApplication
Description: AWS ElasticBeanstalk Sample Application Version
SourceBundle:
S3Bucket: elasticbeanstalk-eu-west-2-776347453069
S3Key: helloworld.zip
sampleConfigurationTemplate:
Type: AWS::ElasticBeanstalk::ConfigurationTemplate
Properties:
ApplicationName:
Ref: sampleApplication
Description: AWS ElasticBeanstalk Sample Configuration Template
OptionSettings:
- Namespace: aws:autoscaling:launchconfiguration
OptionName: IamInstanceProfile
Value: aws-elasticbeanstalk-ec2-role
- Namespace: aws:elasticbeanstalk:environment
OptionName: ServiceRole
Value: AWSServiceRoleForElasticBeanstalk
- Namespace: aws:ec2:vpc
OptionName: Subnets
Value:
!Join
- ","
- Ref: ec2Subnets
- Namespace: aws:ec2:vpc
OptionName: ELBSubnets
Value:
!Join
- ","
- Ref: albSubnets
- Namespace: aws:autoscaling:asg
OptionName: MinSize
Value: '2'
- Namespace: aws:autoscaling:asg
OptionName: MaxSize
Value: '6'
- Namespace: aws:elasticbeanstalk:environment
OptionName: EnvironmentType
Value: LoadBalanced
- Namespace: aws:elasticbeanstalk:environment
OptionName: LoadBalancerType
Value: application
- Namespace: aws:elbv2:listener:8080
OptionName: ListenerEnabled
Value: true
SolutionStackName: 64bit Amazon Linux 2017.09 v2.6.0 running PHP 7.1
sampleEnvironment:
Type: AWS::ElasticBeanstalk::Environment
Properties:
ApplicationName:
Ref: sampleApplication
Description: AWS ElasticBeanstalk Sample Environment
TemplateName:
Ref: sampleConfigurationTemplate
VersionLabel:
Ref: sampleApplicationVersion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment