-
-
Save nk-gears/943497fc3734e3f78301ee27545769a5 to your computer and use it in GitHub Desktop.
Cloud Formation Template (danielparker.com.au) WordPress and Elastic Beanstalk
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
{ | |
"Outputs":{ | |
"AWSEBLoadBalancerURL":{ | |
"Value":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"http:\/\/", | |
{ | |
"Fn::GetAtt":[ | |
"AWSEBLoadBalancer", | |
"DNSName" | |
] | |
} | |
] | |
] | |
}, | |
"Description":"The ElasticBeanstalk ELB URL of the website" | |
} | |
}, | |
"AWSTemplateFormatVersion":"2010-09-09", | |
"Parameters":{ | |
"LogPublicationControl":{ | |
"ConstraintDescription":"must be Boolean.", | |
"NoEcho":"true", | |
"Type":"String", | |
"Description":"If true customer service logs will be published to S3.", | |
"AllowedValues":[ | |
"true", | |
"false" | |
], | |
"Default":"false" | |
}, | |
"DocumentRoot":{ | |
"NoEcho":"true", | |
"Type":"String", | |
"Description":"Enables you to specify the child directory of your project that is treated as the public-facing web root. If your root document is stored in your project directory, leave this set to \"\/\". If your root document is inside a child directory (e.g., <project>\/public), set this value to match the child directory. Values should begin with a \"\/\" character, and may NOT begin with a \".\" character.", | |
"Default":"" | |
}, | |
"InstancePort":{ | |
"NoEcho":"true", | |
"Type":"String", | |
"Description":"Listen Port", | |
"Default":"80" | |
}, | |
"DisplayErrors":{ | |
"NoEcho":"true", | |
"Type":"String", | |
"Description":"Specifies whether error messages should be part of the output. (This value is written to the php.ini file.)", | |
"Default":"Off" | |
}, | |
"AWSEBEnvironmentId":{ | |
"NoEcho":"true", | |
"Type":"String" | |
}, | |
"HooksPkgUrl":{ | |
"NoEcho":"true", | |
"Type":"String", | |
"Description":"URL to hooks package", | |
"Default":"https:\/\/s3-ap-southeast-2.amazonaws.com\/elasticbeanstalk-env-resources-ap-southeast-2\/stalks\/eb_php_4.0.1.22.8\/lib\/assets.tar.gz" | |
}, | |
"ZlibOutputCompression":{ | |
"NoEcho":"true", | |
"Type":"String", | |
"Description":"Specifies whether PHP should use compression for output. (This value is written to the php.ini file.)", | |
"Default":"Off" | |
}, | |
"AWSEBEnvironmentName":{ | |
"NoEcho":"true", | |
"Type":"String" | |
}, | |
"AWSEBReferrerId":{ | |
"Default":"", | |
"NoEcho":"true", | |
"Type":"String" | |
}, | |
"AppSource":{ | |
"NoEcho":"true", | |
"Type":"String", | |
"Description":"The url of the application source.", | |
"Default":"http:\/\/s3-ap-southeast-2.amazonaws.com\/elasticbeanstalk-samples-ap-southeast-2\/php-newsample-app.zip" | |
}, | |
"MaxExecutionTime":{ | |
"NoEcho":"true", | |
"Type":"Number", | |
"Description":"Sets the maximum time, in seconds, a script is allowed to run before it is terminated by the environment. This helps prevent poorly written scripts from tying up the server.", | |
"Default":60 | |
}, | |
"MemoryLimit":{ | |
"NoEcho":"true", | |
"Type":"String", | |
"Description":"Specifies the amount of memory allocated to the PHP environment. (This value is written to the php.ini file.)", | |
"Default":"256M" | |
}, | |
"EnvironmentVariables":{ | |
"NoEcho":"true", | |
"Type":"CommaDelimitedList", | |
"Description":"Program environment variables.", | |
"Default":"" | |
}, | |
"AllowUrlFopen":{ | |
"NoEcho":"true", | |
"Type":"String", | |
"Description":"Specifies whether the PHP's file functions are allowed to retrieve data from remote locations, such as websites or FTP servers. (This value is written to the php.ini file.)", | |
"Default":"On" | |
}, | |
"AWSEBAgentId":{ | |
"Default":"", | |
"NoEcho":"true", | |
"Type":"String" | |
}, | |
"ComposerOptions":{ | |
"NoEcho":"true", | |
"Type":"String", | |
"Description":"Sets custom options to use when installing dependencies using Composer through composer.phar install", | |
"Default":"" | |
}, | |
"InstanceType":{ | |
"ConstraintDescription":"must be a valid EC2 instance type.", | |
"NoEcho":"true", | |
"Type":"String", | |
"Description":"WebServer EC2 instance type", | |
"AllowedValues":[ | |
"t2.micro", | |
"t2.small", | |
"t2.medium", | |
"t2.large", | |
"m3.medium", | |
"m3.large", | |
"m3.xlarge", | |
"m3.2xlarge", | |
"c3.large", | |
"c3.xlarge", | |
"c3.2xlarge", | |
"c3.4xlarge", | |
"c3.8xlarge", | |
"t1.micro", | |
"m1.small", | |
"m1.medium", | |
"m1.large", | |
"m1.xlarge", | |
"c1.medium", | |
"c1.xlarge", | |
"c4.large", | |
"c4.xlarge", | |
"c4.2xlarge", | |
"c4.4xlarge", | |
"c4.8xlarge", | |
"m2.xlarge", | |
"m2.2xlarge", | |
"m2.4xlarge", | |
"m4.large", | |
"m4.xlarge", | |
"m4.2xlarge", | |
"m4.4xlarge", | |
"m4.10xlarge", | |
"g2.2xlarge", | |
"g2.8xlarge", | |
"i2.xlarge", | |
"i2.2xlarge", | |
"i2.4xlarge", | |
"i2.8xlarge", | |
"r3.large", | |
"r3.xlarge", | |
"r3.2xlarge", | |
"r3.4xlarge", | |
"r3.8xlarge" | |
], | |
"Default":"t1.micro" | |
}, | |
"AWSEBEnvironmentBucket":{ | |
"NoEcho":"true", | |
"Type":"String" | |
} | |
}, | |
"Resources":{ | |
"AWSEBSecurityGroupSSHIngress":{ | |
"Properties":{ | |
"CidrIp":"0.0.0.0\/0", | |
"FromPort":"22", | |
"ToPort":"22", | |
"IpProtocol":"tcp", | |
"GroupId":{ | |
"Ref":"AWSEBSecurityGroup" | |
} | |
}, | |
"Type":"AWS::EC2::SecurityGroupIngress" | |
}, | |
"AWSEBAutoScalingLaunchConfiguration":{ | |
"Properties":{ | |
"KeyName":"daniel-key-pair-sydney", | |
"SecurityGroups":[ | |
"sg-d473e3b1", | |
{ | |
"Ref":"AWSEBSecurityGroup" | |
} | |
], | |
"UserData":{ | |
"Fn::Base64":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"Content-Type: multipart\/mixed; boundary=\"===============5189065377222898407==\"", | |
"\n", | |
"MIME-Version: 1.0", | |
"\n", | |
"", | |
"\n", | |
"--===============5189065377222898407==", | |
"\n", | |
"Content-Type: text\/cloud-config; charset=\"us-ascii\"", | |
"\n", | |
"MIME-Version: 1.0", | |
"\n", | |
"Content-Transfer-Encoding: 7bit", | |
"\n", | |
"Content-Disposition: attachment; filename=\"cloud-config.txt\"", | |
"\n", | |
"", | |
"\n", | |
"#cloud-config", | |
"\n", | |
"repo_upgrade: none", | |
"\n", | |
"repo_releasever: ", | |
{ | |
"Fn::FindInMap":[ | |
"ContainerMeta", | |
"AMIMeta", | |
"RepoReleaseVersion" | |
] | |
}, | |
"\n", | |
{ | |
"Fn::FindInMap":[ | |
"AWSEBOptions", | |
"options", | |
"CloudConfigOptions" | |
] | |
}, | |
"\n", | |
"", | |
"\n", | |
"--===============5189065377222898407==", | |
"\n", | |
"Content-Type: text\/x-shellscript; charset=\"us-ascii\"", | |
"\n", | |
"MIME-Version: 1.0", | |
"\n", | |
"Content-Transfer-Encoding: 7bit", | |
"\n", | |
"Content-Disposition: attachment; filename=\"user-data.txt\"", | |
"\n\n", | |
"#!\/bin\/bash", | |
"\n", | |
"exec > >(tee -a \/var\/log\/eb-cfn-init.log|logger -t [eb-cfn-init] -s 2>\/dev\/console) 2>&1", | |
"\n", | |
"echo [`date -u +\"%Y-%m-%dT%H:%M:%SZ\"`] Started EB User Data", | |
"\n", | |
"set -x", | |
"\n", | |
"\n\n", | |
"function sleep_delay ", | |
"\n", | |
"{", | |
"\n", | |
" if (( $SLEEP_TIME < $SLEEP_TIME_MAX )); then ", | |
"\n", | |
" echo Sleeping $SLEEP_TIME", | |
"\n", | |
" sleep $SLEEP_TIME ", | |
"\n", | |
" SLEEP_TIME=$(($SLEEP_TIME * 2)) ", | |
"\n", | |
" else ", | |
"\n", | |
" echo Sleeping $SLEEP_TIME_MAX ", | |
"\n", | |
" sleep $SLEEP_TIME_MAX ", | |
"\n", | |
" fi", | |
"\n", | |
"}", | |
"\n\n", | |
"# Executing bootstrap script", | |
"\n", | |
"SLEEP_TIME=10", | |
"\n", | |
"SLEEP_TIME_MAX=3600", | |
"\n", | |
"while true; do ", | |
"\n", | |
" curl ", | |
{ | |
"Fn::FindInMap":[ | |
"AWSEBOptions", | |
"options", | |
"UserDataScript" | |
] | |
}, | |
" > \/tmp\/ebbootstrap.sh ", | |
"\n", | |
" RESULT=$?", | |
"\n", | |
" if [[ \"$RESULT\" -ne 0 ]]; then ", | |
"\n", | |
" sleep_delay ", | |
"\n", | |
" else", | |
"\n", | |
" \/bin\/bash \/tmp\/ebbootstrap.sh ", | |
" '", | |
{ | |
"Fn::FindInMap":[ | |
"AWSEBOptions", | |
"options", | |
"rpms" | |
] | |
}, | |
"'", | |
" '", | |
{ | |
"Fn::FindInMap":[ | |
"AWSEBOptions", | |
"options", | |
"tarballs" | |
] | |
}, | |
"'", | |
" '", | |
{ | |
"Fn::FindInMap":[ | |
"AWSEBOptions", | |
"options", | |
"ebgems" | |
] | |
}, | |
"'", | |
" '", | |
{ | |
"Ref":"AWSEBInstanceLaunchWaitHandle" | |
}, | |
"'", | |
" '", | |
{ | |
"Ref":"AWS::StackId" | |
}, | |
"'", | |
" '", | |
{ | |
"Ref":"AWS::Region" | |
}, | |
"'", | |
" '", | |
{ | |
"Fn::FindInMap":[ | |
"AWSEBOptions", | |
"options", | |
"guid" | |
] | |
}, | |
"'", | |
" '", | |
{ | |
"Fn::FindInMap":[ | |
"AWSEBOptions", | |
"options", | |
"AWSEBHealthdGroupId" | |
] | |
}, | |
"'", | |
" '", | |
{ | |
"Fn::FindInMap":[ | |
"AWSEBOptions", | |
"options", | |
"AWSEBHealthdEndpoint" | |
] | |
}, | |
"'", | |
" '", | |
{ | |
"Fn::FindInMap":[ | |
"AWSEBOptions", | |
"options", | |
"ProxyServer" | |
] | |
}, | |
"'", | |
" '", | |
{ | |
"Fn::FindInMap":[ | |
"AWSEBOptions", | |
"options", | |
"HealthdProxyLogLocation" | |
] | |
}, | |
"'", | |
" && ", | |
"\n", | |
" exit 0 ", | |
"\n", | |
" fi ", | |
"\n", | |
"done", | |
"\n\n", | |
"--===============5189065377222898407==-- ", | |
"##Ec2InstanceReplacementRequest=68e35864-85b6-11e5-8724-03fe034960d8" | |
] | |
] | |
} | |
}, | |
"ImageId":{ | |
"Fn::FindInMap":[ | |
"AWSEBAWSRegionArch2AMI", | |
{ | |
"Ref":"AWS::Region" | |
}, | |
{ | |
"Fn::FindInMap":[ | |
"AWSEBAWSInstanceType2Arch", | |
{ | |
"Ref":"InstanceType" | |
}, | |
"Arch" | |
] | |
} | |
] | |
}, | |
"IamInstanceProfile":"aws-elasticbeanstalk-ec2-role", | |
"InstanceType":{ | |
"Ref":"InstanceType" | |
}, | |
"AssociatePublicIpAddress":"true", | |
"InstanceMonitoring":false | |
}, | |
"Type":"AWS::AutoScaling::LaunchConfiguration" | |
}, | |
"AWSEBUpdateWaitConditionxwaxZO":{ | |
"Type":"AWS::CloudFormation::WaitCondition", | |
"DependsOn":[ | |
"AWSEBSecurityGroupSSHIngress", | |
"AWSEBAutoScalingLaunchConfiguration", | |
"AWSEBLoadBalancer", | |
"AWSEBLoadBalancerSecurityGroup", | |
"AWSEBSecurityGroup", | |
"AWSEBAutoScalingScaleDownPolicy", | |
"AWSEBInstanceLaunchWaitHandle", | |
"AWSEBAutoScalingGroup", | |
"AWSEBInstanceLaunchWaitCondition", | |
"AWSEBAutoScalingScaleUpPolicy", | |
"AWSEBCloudwatchAlarmHigh", | |
"AWSEBBeanstalkMetadata", | |
"AWSEBCloudwatchAlarmLow" | |
], | |
"Properties":{ | |
"Timeout":"43200", | |
"Count":"1", | |
"Handle":{ | |
"Ref":"AWSEBUpdateWaitConditionHandlexwaxZO" | |
} | |
} | |
}, | |
"AWSEBLoadBalancer":{ | |
"Properties":{ | |
"SecurityGroups":[ | |
{ | |
"Ref":"AWSEBLoadBalancerSecurityGroup" | |
} | |
], | |
"Listeners":[ | |
{ | |
"LoadBalancerPort":"80", | |
"Protocol":"HTTP", | |
"InstancePort":{ | |
"Ref":"InstancePort" | |
} | |
}, | |
{ | |
"LoadBalancerPort":"443", | |
"Protocol":"HTTPS", | |
"SSLCertificateId":"arn:aws:iam::<account-id>:server-certificate\/cloudfront\/danielparker.com.au-cloudfront", | |
"InstancePort":"80" | |
} | |
], | |
"Subnets":[ | |
"subnet-1c38e46b", | |
"subnet-351a9550" | |
], | |
"CrossZone":false, | |
"ConnectionDrainingPolicy":{ | |
"Timeout":20, | |
"Enabled":true | |
}, | |
"Policies":[ | |
], | |
"HealthCheck":{ | |
"Target":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"HTTP:", | |
{ | |
"Ref":"InstancePort" | |
}, | |
"\/healthcheck.html" | |
] | |
] | |
}, | |
"UnhealthyThreshold":"5", | |
"Timeout":"5", | |
"HealthyThreshold":"3", | |
"Interval":"10" | |
} | |
}, | |
"Type":"AWS::ElasticLoadBalancing::LoadBalancer" | |
}, | |
"AWSEBLoadBalancerSecurityGroup":{ | |
"Properties":{ | |
"GroupDescription":"Load Balancer Security Group", | |
"VpcId":"vpc-f9cb169c", | |
"SecurityGroupIngress":[ | |
{ | |
"CidrIp":"0.0.0.0\/0", | |
"FromPort":"80", | |
"ToPort":"80", | |
"IpProtocol":"tcp" | |
}, | |
{ | |
"CidrIp":"0.0.0.0\/0", | |
"FromPort":"443", | |
"ToPort":"443", | |
"IpProtocol":"tcp" | |
} | |
], | |
"SecurityGroupEgress":[ | |
{ | |
"CidrIp":"0.0.0.0\/0", | |
"FromPort":"80", | |
"ToPort":"80", | |
"IpProtocol":"tcp" | |
}, | |
{ | |
"CidrIp":"0.0.0.0\/0", | |
"FromPort":"80", | |
"ToPort":"80", | |
"IpProtocol":"tcp" | |
} | |
] | |
}, | |
"Type":"AWS::EC2::SecurityGroup" | |
}, | |
"AWSEBSecurityGroup":{ | |
"Properties":{ | |
"GroupDescription":"VPC Security Group", | |
"VpcId":"vpc-f9cb169c", | |
"SecurityGroupIngress":[ | |
{ | |
"FromPort":"80", | |
"ToPort":"80", | |
"IpProtocol":"tcp", | |
"SourceSecurityGroupId":{ | |
"Ref":"AWSEBLoadBalancerSecurityGroup" | |
} | |
} | |
] | |
}, | |
"Type":"AWS::EC2::SecurityGroup" | |
}, | |
"AWSEBAutoScalingScaleDownPolicy":{ | |
"Properties":{ | |
"ScalingAdjustment":"-1", | |
"AutoScalingGroupName":{ | |
"Ref":"AWSEBAutoScalingGroup" | |
}, | |
"AdjustmentType":"ChangeInCapacity" | |
}, | |
"Type":"AWS::AutoScaling::ScalingPolicy" | |
}, | |
"AWSEBInstanceLaunchWaitHandle":{ | |
"Type":"AWS::CloudFormation::WaitConditionHandle" | |
}, | |
"AWSEBAutoScalingGroup":{ | |
"Metadata":{ | |
"ForcingMetadataUpdate":"Changing something in the metadata will force re-compuation", | |
"AWS::CloudFormation::Init":{ | |
"Infra-WriteTailLogsConf":{ | |
"files":{ | |
"\/opt\/elasticbeanstalk\/tasks\/taillogs.d\/eb-activity.conf":{ | |
"mode":"000644", | |
"content":{ | |
"Fn::Join":[ | |
"\n", | |
[ | |
"\/var\/log\/eb-commandprocessor.log", | |
"\/var\/log\/eb-activity.log", | |
"" | |
] | |
] | |
} | |
}, | |
"\/opt\/elasticbeanstalk\/tasks\/taillogs.d\/eb-version-deployment.conf":{ | |
"content":{ | |
"Fn::Join":[ | |
"\n", | |
[ | |
"\/var\/log\/eb-version-deployment.log", | |
"" | |
] | |
] | |
} | |
} | |
} | |
}, | |
"Infra-WriteBundleLogsConf":{ | |
"files":{ | |
"\/opt\/elasticbeanstalk\/tasks\/bundlelogs.d\/eb-system.conf":{ | |
"mode":"000644", | |
"content":{ | |
"Fn::Join":[ | |
"\n", | |
[ | |
"\/var\/log\/eb-cfn-init*", | |
"\/var\/log\/eb-tools*", | |
"\/var\/log\/eb-publish-logs*", | |
"\/var\/log\/eb-commandprocessor*", | |
"\/var\/log\/eb-activity*", | |
"" | |
] | |
] | |
} | |
}, | |
"\/opt\/elasticbeanstalk\/tasks\/bundlelogs.d\/cfn-system.conf":{ | |
"mode":"000644", | |
"content":{ | |
"Fn::Join":[ | |
"\n", | |
[ | |
"\/var\/log\/cfn-hup*", | |
"\/var\/log\/cfn-init*", | |
"" | |
] | |
] | |
} | |
}, | |
"\/opt\/elasticbeanstalk\/tasks\/bundlelogs.d\/eb-version-deployment.conf":{ | |
"content":{ | |
"Fn::Join":[ | |
"\n", | |
[ | |
"\/var\/log\/eb-version-deployment.log", | |
"" | |
] | |
] | |
} | |
}, | |
"\/opt\/elasticbeanstalk\/tasks\/bundlelogs.d\/cloud-init-system.conf":{ | |
"mode":"000644", | |
"content":{ | |
"Fn::Join":[ | |
"\n", | |
[ | |
"\/var\/log\/cloud-init*", | |
"" | |
] | |
] | |
} | |
}, | |
"\/opt\/elasticbeanstalk\/tasks\/bundlelogs.d\/system.conf":{ | |
"mode":"000644", | |
"content":{ | |
"Fn::Join":[ | |
"\n", | |
[ | |
"\/var\/log\/cron", | |
"\/var\/log\/messages", | |
"\/var\/log\/yum.log", | |
"" | |
] | |
] | |
} | |
} | |
} | |
}, | |
"InfoTask-TailLogs":{ | |
"commands":{ | |
"taillogs":{ | |
"command":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"tailLogs.py --concatenate --conf-path '\/opt\/elasticbeanstalk\/tasks\/taillogs.d\/*' --location-prefix ", | |
{ | |
"Fn::FindInMap":[ | |
"EnvironmentInfoTasks", | |
"tail", | |
"LocationPrefix" | |
] | |
} | |
] | |
] | |
} | |
} | |
} | |
}, | |
"Infra-WriteLeaderTestScript":{ | |
"files":{ | |
"\/opt\/elasticbeanstalk\/bin\/leader-test.sh":{ | |
"mode":"000755", | |
"content":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"#!\/bin\/bash", | |
"\n", | |
"if [[ \"$EB_IS_COMMAND_LEADER\" == \"true\" ]]; then ", | |
"\n", | |
" exit 0 ", | |
"\n", | |
"else ", | |
"\n", | |
" exit 1 ", | |
"\n", | |
"fi ", | |
"\n" | |
] | |
] | |
} | |
} | |
} | |
}, | |
"InfoTask-BundleLogs":{ | |
"commands":{ | |
"bundlelogs":{ | |
"command":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"bundleLogs.py --conf-path '\/opt\/elasticbeanstalk\/tasks\/bundlelogs.d\/*' --location-prefix ", | |
{ | |
"Fn::FindInMap":[ | |
"EnvironmentInfoTasks", | |
"bundle", | |
"LocationPrefix" | |
] | |
} | |
] | |
] | |
} | |
} | |
} | |
}, | |
"Infra-InstallBaseHooksPkg":{ | |
"commands":{ | |
"03cleanup":{ | |
"command":"rm -f \/tmp\/basehooks.tar.gz" | |
}, | |
"01download_base_hooks":{ | |
"command":"curl -sS --retry 3 'https:\/\/s3-ap-southeast-2.amazonaws.com\/elasticbeanstalk-env-resources-ap-southeast-2\/stalks\/eb_php_4.0.1.22.8\/lib\/basehooks.tar.gz' -o \/tmp\/basehooks.tar.gz" | |
}, | |
"00mkdir":{ | |
"command":"mkdir -p \/opt\/elasticbeanstalk" | |
}, | |
"02install_base_hooks":{ | |
"command":"tar zxf \/tmp\/basehooks.tar.gz --no-same-owner --no-same-permission -C \/opt\/elasticbeanstalk" | |
} | |
} | |
}, | |
"AWSEBBaseConfig":{ | |
"files":{ | |
"\/etc\/cfn\/cfn-hup.conf":{ | |
"mode":"000400", | |
"owner":"root", | |
"content":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"[main]", | |
"\n", | |
"stack=", | |
{ | |
"Ref":"AWS::StackId" | |
}, | |
"\n", | |
"region=", | |
{ | |
"Ref":"AWS::Region" | |
}, | |
"\n", | |
"verbose=true\n", | |
"multi-threaded=false\n" | |
] | |
] | |
}, | |
"group":"root" | |
}, | |
"\/etc\/elasticbeanstalk\/.aws-eb-stack.properties":{ | |
"mode":"000440", | |
"owner":"root", | |
"content":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"environment_id=", | |
{ | |
"Ref":"AWSEBEnvironmentId" | |
}, | |
"\n", | |
"environment_bucket=", | |
{ | |
"Ref":"AWSEBEnvironmentBucket" | |
}, | |
"\n", | |
"stack_name=", | |
{ | |
"Ref":"AWS::StackId" | |
}, | |
"\n", | |
"resource=", | |
"AWSEBAutoScalingGroup", | |
"\n", | |
"region=", | |
{ | |
"Ref":"AWS::Region" | |
}, | |
"\n\n" | |
] | |
] | |
}, | |
"group":"root" | |
}, | |
"\/etc\/init\/cfn-hup.conf":{ | |
"mode":"000400", | |
"owner":"root", | |
"content":{ | |
"Fn::Join":[ | |
"\n", | |
[ | |
"stop on runlevel [016]", | |
"respawn", | |
"script", | |
" \/opt\/aws\/bin\/cfn-hup", | |
"end script" | |
] | |
] | |
}, | |
"group":"root" | |
}, | |
"\/etc\/cfn\/hooks.d\/aws-eb-command-handler.conf":{ | |
"content":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"[aws-eb-command-handler]", | |
"\n", | |
"triggers=on.command", | |
"\n", | |
"path=ElasticBeanstalkCommand-", | |
"AWSEBAutoScalingGroup", | |
"\n", | |
"action=\/opt\/elasticbeanstalk\/bin\/command-processor", | |
"\n" | |
] | |
] | |
} | |
} | |
}, | |
"commands":{ | |
"clearbackupfiles":{ | |
"command":"rm -f \/etc\/cfn\/hooks.d\/*.bak" | |
} | |
} | |
}, | |
"Hook-PreAppDeploy":{ | |
"commands":{ | |
"hooks":{ | |
"command":"echo place holder" | |
} | |
} | |
}, | |
"InfoTask-SystemTailLogs":{ | |
"commands":{ | |
"systemtaillogs":{ | |
"command":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"tailLogs.py --conf-path '\/opt\/elasticbeanstalk\/tasks\/systemtaillogs.d\/*' --location-prefix ", | |
{ | |
"Fn::FindInMap":[ | |
"EnvironmentInfoTasks", | |
"systemtail", | |
"LocationPrefix" | |
] | |
} | |
] | |
] | |
} | |
} | |
} | |
}, | |
"AWSEBMessageOfTheDay":{ | |
"files":{ | |
"\/tmp\/10eb-banner":{ | |
"mode":"000755", | |
"owner":"root", | |
"content":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"cat << EOF", | |
"\n", | |
" _____ _ _ _ ____ _ _ _", | |
"\n", | |
"| ____| | __ _ ___| |_(_) ___| __ ) ___ __ _ _ __ ___| |_ __ _| | | __", | |
"\n", | |
"| _| | |\/ _\\` \/ __| __| |\/ __| _ \\ \/ _ \\\/ _\\` | '_ \\\/ __| __\/ _\\` | | |\/ \/", | |
"\n", | |
"| |___| | (_| \\__ \\ |_| | (__| |_) | __\/ (_| | | | \\__ \\ || (_| | | <", | |
"\n", | |
"|_____|_|\\__,_|___\/\\__|_|\\___|____\/ \\___|\\__,_|_| |_|___\/\\__\\__,_|_|_|\\_\\\\", | |
"\n", | |
" Amazon Linux AMI", | |
"\n", | |
"\n", | |
"This EC2 instance is managed by AWS Elastic Beanstalk. Changes made via SSH ", | |
"\n", | |
"WILL BE LOST if the instance is replaced by auto-scaling. For more information ", | |
"\n", | |
"on customizing your Elastic Beanstalk environment, see our documentation here: ", | |
"\n", | |
"http:\/\/docs.aws.amazon.com\/elasticbeanstalk\/latest\/dg\/customize-containers-ec2.html", | |
"\n", | |
"EOF", | |
"\n" | |
] | |
] | |
}, | |
"group":"root" | |
} | |
}, | |
"commands":{ | |
"01clearoriginal":{ | |
"command":"rm -f \/etc\/update-motd.d\/*" | |
}, | |
"02createbanner":{ | |
"command":"mv \/tmp\/10eb-banner \/etc\/update-motd.d\/10eb-banner" | |
}, | |
"03updatebanner":{ | |
"command":"\/usr\/sbin\/update-motd" | |
} | |
} | |
}, | |
"Infra-WriteSystemTailLogsConf":{ | |
"files":{ | |
"\/opt\/elasticbeanstalk\/tasks\/systemtaillogs.d\/eb-system.conf":{ | |
"mode":"000644", | |
"content":{ | |
"Fn::Join":[ | |
"\n", | |
[ | |
"\/var\/log\/eb-cfn-init.log", | |
"\/var\/log\/eb-tools.log", | |
"\/var\/log\/eb-publish-logs.log", | |
"\/var\/log\/eb-commandprocessor.log", | |
"\/var\/log\/eb-activity.log", | |
"" | |
] | |
] | |
} | |
}, | |
"\/opt\/elasticbeanstalk\/tasks\/systemtaillogs.d\/eb-version-deployment.conf":{ | |
"content":{ | |
"Fn::Join":[ | |
"\n", | |
[ | |
"\/var\/log\/eb-version-deployment.log", | |
"" | |
] | |
] | |
} | |
}, | |
"\/opt\/elasticbeanstalk\/tasks\/systemtaillogs.d\/cfn-system.conf":{ | |
"mode":"000644", | |
"content":{ | |
"Fn::Join":[ | |
"\n", | |
[ | |
"\/var\/log\/cfn-hup.log", | |
"\/var\/log\/cfn-init.log", | |
"" | |
] | |
] | |
} | |
}, | |
"\/opt\/elasticbeanstalk\/tasks\/systemtaillogs.d\/system.conf":{ | |
"mode":"000644", | |
"content":{ | |
"Fn::Join":[ | |
"\n", | |
[ | |
"\/var\/log\/cron", | |
"\/var\/log\/messages", | |
"\/var\/log\/yum.log", | |
"" | |
] | |
] | |
} | |
}, | |
"\/opt\/elasticbeanstalk\/tasks\/systemtaillogs.d\/cloud-init-system.conf":{ | |
"mode":"000644", | |
"content":{ | |
"Fn::Join":[ | |
"\n", | |
[ | |
"\/var\/log\/cloud-init.log", | |
"" | |
] | |
] | |
} | |
} | |
} | |
}, | |
"Infra-PatchInstance":{ | |
"files":{ | |
"\/opt\/elasticbeanstalk\/bin\/patch_instance":{ | |
"mode":"000750", | |
"owner":"root", | |
"source":{ | |
"Fn::Select":[ | |
0, | |
{ | |
"Fn::FindInMap":[ | |
"AWSEBOptions", | |
"options", | |
"ebpatchscripturl" | |
] | |
} | |
] | |
}, | |
"group":"root" | |
} | |
}, | |
"commands":{ | |
"01executepatch":{ | |
"command":"\/opt\/elasticbeanstalk\/bin\/patch_instance" | |
} | |
} | |
}, | |
"Infra-InstallContainerHooksPkg":{ | |
"commands":{ | |
"01download_container_hooks":{ | |
"command":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"curl -sS --retry 3 '", | |
{ | |
"Ref":"HooksPkgUrl" | |
}, | |
"' -o \/tmp\/hooks.tar.gz" | |
] | |
] | |
} | |
}, | |
"03cleanup":{ | |
"command":"rm -f \/tmp\/hooks.tar.gz" | |
}, | |
"00mkdir":{ | |
"command":"mkdir -p \/opt\/elasticbeanstalk" | |
}, | |
"02install_container_hooks":{ | |
"command":"tar zxf \/tmp\/hooks.tar.gz --no-same-owner --no-same-permission -C \/opt\/elasticbeanstalk" | |
} | |
} | |
}, | |
"Infra-WritePublishLogsCron":{ | |
"files":{ | |
"\/etc\/cron.d\/publishlogs":{ | |
"mode":"000644", | |
"content":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"SHELL=\/bin\/bash", | |
"\n", | |
"PATH=\/sbin:\/bin:\/usr\/sbin:\/usr\/bin", | |
"\n", | |
"MAILTO=\"\"", | |
"\n", | |
"HOME=\/", | |
"\n", | |
"10,30,50 * * * * root ", | |
"publishLogs.py --de-dupe --conf-path '\/opt\/elasticbeanstalk\/tasks\/publishlogs.d\/*' --location-prefix ", | |
{ | |
"Fn::FindInMap":[ | |
"EnvironmentInfoTasks", | |
"publish", | |
"LocationPrefix" | |
] | |
}, | |
" --num-concurrent 2", | |
"\n", | |
"05,25,45 * * * * root ", | |
"clearStaleLogPublishingRecords.py", | |
"\n" | |
] | |
] | |
} | |
} | |
} | |
}, | |
"AWSEBLockCfnBootstap":{ | |
"commands":{ | |
"add_lock":{ | |
"command":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"cat >> \/etc\/yum.conf <<- EOM", | |
"\n", | |
"\n", | |
"# Locking version of cfn-bootstrap", | |
"\n", | |
"exclude=aws-cfn-bootstrap.noarch", | |
"\n", | |
"EOM", | |
"\n" | |
] | |
] | |
} | |
} | |
} | |
}, | |
"Infra-WriteApplication1":{ | |
"commands":{ | |
"01mkdir":{ | |
"command":"rm -rf \/opt\/elasticbeanstalk\/deploy\/appsource\/; mkdir -p \/opt\/elasticbeanstalk\/deploy\/appsource\/" | |
} | |
} | |
}, | |
"configSets":{ | |
"Infra-WriteTailLogsConf":[ | |
"Infra-WriteTailLogsConf" | |
], | |
"Infra-WriteBundleLogsConf":[ | |
"Infra-WriteBundleLogsConf" | |
], | |
"InfoTask-TailLogs":[ | |
"InfoTask-TailLogs" | |
], | |
"InfoTask-BundleLogs":[ | |
"InfoTask-BundleLogs" | |
], | |
"_OnInstanceReboot":[ | |
"AWSEBBaseConfig" | |
], | |
"_AppInstall":[ | |
"Hook-PreAppDeploy" | |
], | |
"Infra-EmbeddedPreBuild":[ | |
], | |
"Hook-PreAppDeploy":[ | |
"Hook-PreAppDeploy" | |
], | |
"InfoTask-SystemTailLogs":[ | |
"InfoTask-SystemTailLogs" | |
], | |
"Infra-WriteSystemTailLogsConf":[ | |
"Infra-WriteSystemTailLogsConf" | |
], | |
"_OnInstanceBoot":[ | |
"AWSEBBaseConfig", | |
"AWSEBMessageOfTheDay", | |
"AWSEBULimitConfig", | |
"Infra-InstallBaseHooksPkg", | |
"Infra-InstallContainerHooksPkg", | |
"Infra-WriteLeaderTestScript", | |
"AWSEBLockCfnBootstap", | |
"Infra-WriteTailLogsConf", | |
"Infra-WriteSystemTailLogsConf", | |
"Infra-WriteBundleLogsConf", | |
"Infra-WritePublishLogsConf", | |
"Infra-WritePublishLogsCron" | |
], | |
"Infra-EmbeddedPostBuild":[ | |
], | |
"Infra-WritePublishLogsCron":[ | |
"Infra-WritePublishLogsCron" | |
], | |
"Infra-WriteApplication1":[ | |
"Infra-WriteApplication1" | |
], | |
"Infra-WriteApplication2":[ | |
"Infra-WriteApplication2" | |
], | |
"Infra-WritePublishLogsConf":[ | |
"Infra-WritePublishLogsConf" | |
], | |
"_Infra-PatchInstance":[ | |
"Infra-PatchInstance" | |
] | |
}, | |
"Infra-WriteApplication2":{ | |
"files":{ | |
"\/opt\/elasticbeanstalk\/bin\/download_source_bundle":{ | |
"owner":"root", | |
"mode":"000750", | |
"source":{ | |
"Fn::Select":[ | |
0, | |
{ | |
"Fn::FindInMap":[ | |
"AWSEBOptions", | |
"options", | |
"downloadSourceBundleScriptLocation" | |
] | |
} | |
] | |
}, | |
"group":"root" | |
} | |
}, | |
"commands":{ | |
"01downloadVersion":{ | |
"command":"\/opt\/elasticbeanstalk\/bin\/download_source_bundle" | |
}, | |
"02deleteVersionDownloadScriptFile":{ | |
"command":"rm \/opt\/elasticbeanstalk\/bin\/download_source_bundle" | |
} | |
} | |
}, | |
"Infra-WritePublishLogsConf":{ | |
"files":{ | |
} | |
}, | |
"AWSEBULimitConfig":{ | |
"files":{ | |
"\/tmp\/configure-ulimit.sh":{ | |
"mode":"000700", | |
"owner":"root", | |
"content":{ | |
"Fn::Join":[ | |
"", | |
[ | |
"#!\/bin\/bash -xe", | |
"\n", | |
"", | |
"\n", | |
"# System imposed global limit", | |
"\n", | |
"FILES_MAX=$(cat \/proc\/sys\/fs\/file-max)", | |
"\n", | |
"", | |
"\n", | |
"if [[ ! $FILES_MAX =~ ^[0-9]+$ ]]; then", | |
"\n", | |
" echo WARNING: Unable to determine file max for this system", | |
"\n", | |
" exit 0", | |
"\n", | |
"fi", | |
"\n", | |
"", | |
"\n", | |
"# Per user limit", | |
"\n", | |
"let \"USER_LIMIT=$FILES_MAX\/3\"", | |
"\n", | |
"", | |
"\n", | |
"if [ $USER_LIMIT -lt 4096 ]; then", | |
"\n", | |
" USER_LIMIT=4096", | |
"\n", | |
"fi", | |
"\n", | |
"", | |
"\n", | |
"if [ $USER_LIMIT -gt 200000 ]; then", | |
"\n", | |
" USER_LIMIT=200000", | |
"\n", | |
"fi", | |
"\n", | |
"", | |
"\n", | |
"cat << EOF > \/etc\/elasticbeanstalk\/set-ulimit.sh", | |
"\n", | |
"ulimit -n $USER_LIMIT", | |
"\n", | |
"EOF", | |
"\n" | |
] | |
] | |
}, | |
"group":"root" | |
} | |
}, | |
"commands":{ | |
"00createlimitfile":{ | |
"command":"\/tmp\/configure-ulimit.sh" | |
} | |
} | |
} | |
}, | |
"AWS::ElasticBeanstalk::Ext":{ | |
"_AppSourceUrlFileContent":{ | |
"url":{ | |
"Ref":"AppSource" | |
} | |
}, | |
"_TriggersConfig":{ | |
"configDeploy":{ | |
"_Command":"CMD-ConfigDeploy", | |
"_WatchGroups":[ | |
"_TriggerConfigDeployment" | |
] | |
}, | |
"applicationDeploy":{ | |
"_Command":"CMD-AppDeploy", | |
"_WatchGroups":[ | |
"_TriggerAppDeployment" | |
] | |
} | |
}, | |
"_ParameterTriggers":{ | |
"_TriggerConfigDeployment":[ | |
"EnvironmentVariables", | |
"InstancePort", | |
"LogPublicationControl", | |
"DocumentRoot", | |
"MemoryLimit", | |
"ZlibOutputCompression", | |
"AllowUrlFopen", | |
"DisplayErrors", | |
"MaxExecutionTime", | |
"ComposerOptions" | |
], | |
"_TriggerAppDeployment":[ | |
"AppSource" | |
] | |
}, | |
"_ContainerConfigFileContent":{ | |
"container":{ | |
"app_base_dir":"\/var\/app", | |
"app_logs_dir":"\/var\/app\/support\/logs", | |
"app_deploy_dir":"\/var\/app\/current", | |
"app_user":"webapp", | |
"php_version":{ | |
"Fn::FindInMap":[ | |
"AWSEBOptions", | |
"options", | |
"PhpVersion" | |
] | |
}, | |
"app_support_dir":"\/var\/app\/support", | |
"app_pids_dir":"\/var\/app\/support\/pids", | |
"app_staging_dir":"\/var\/app\/ondeck", | |
"app_assets_dir":"\/var\/app\/support\/assets", | |
"instance_port":{ | |
"Ref":"InstancePort" | |
}, | |
"http_port":"80", | |
"source_bundle":"\/opt\/elasticbeanstalk\/deploy\/appsource\/source_bundle" | |
}, | |
"optionsettings":{ | |
"aws:elasticbeanstalk:container:php:phpini":{ | |
"display_errors":{ | |
"Ref":"DisplayErrors" | |
}, | |
"document_root":{ | |
"Ref":"DocumentRoot" | |
}, | |
"composer_options":{ | |
"Ref":"ComposerOptions" | |
}, | |
"allow_url_fopen":{ | |
"Ref":"AllowUrlFopen" | |
}, | |
"zlib_output_compression":{ | |
"Ref":"ZlibOutputCompression" | |
}, | |
"memory_limit":{ | |
"Ref":"MemoryLimit" | |
}, | |
"max_execution_time":{ | |
"Ref":"MaxExecutionTime" | |
} | |
}, | |
"aws:elasticbeanstalk:application:environment":[ | |
"DB_USER=rlgod_blog", | |
"DB_NAME=rlgod_blog", | |
"WP_HOME=http:\/\/danielparker.com.au", | |
"WP_SITEURL=http:\/\/danielparker.com.au\/wp", | |
"DB_HOST=dpdb.chs2k4i2o2ec.ap-southeast-2.rds.amazonaws.com", | |
"DB_PASSWORD=8165en+2IS7=" | |
], | |
"aws:elasticbeanstalk:hostmanager":{ | |
"LogPublicationControl":{ | |
"Ref":"LogPublicationControl" | |
} | |
} | |
}, | |
"system":{ | |
"LogPublicationControl":{ | |
"Ref":"LogPublicationControl" | |
}, | |
"AWSEBAgentId":{ | |
"Ref":"AWSEBAgentId" | |
}, | |
"AWSEBReferrerId":{ | |
"Ref":"AWSEBReferrerId" | |
} | |
}, | |
"commands":{ | |
"CMD-TailLogs":{ | |
"stages":[ | |
{ | |
"name":"TailLogs", | |
"actions":[ | |
{ | |
"name":"TailLogs", | |
"type":"sh", | |
"value":"tailLogs.py --concatenate --conf-path '\/opt\/elasticbeanstalk\/tasks\/taillogs.d\/*' --location-prefix 'resources\/environments\/logs\/tail\/'" | |
} | |
] | |
} | |
] | |
}, | |
"CMD-PreInit":{ | |
"stages":[ | |
{ | |
"name":"PreInitStage0", | |
"actions":[ | |
{ | |
"name":"InfraWriteConfig", | |
"type":"infra", | |
"value":"writeruntimeconfig" | |
}, | |
{ | |
"name":"InfraWriteApp1", | |
"type":"infra", | |
"value":"writeapplication1" | |
}, | |
{ | |
"name":"InfraWriteApp2", | |
"type":"infra", | |
"value":"writeapplication2" | |
}, | |
{ | |
"name":"PreInitHook", | |
"type":"hook", | |
"value":"preinit" | |
} | |
] | |
} | |
] | |
}, | |
"CMD-Startup":{ | |
"stages":[ | |
{ | |
"name":"StartupStage0", | |
"actions":[ | |
{ | |
"name":"HealthdLogRotation", | |
"type":"infra", | |
"value":"healthd_log_rotation" | |
}, | |
{ | |
"name":"HealthdHTTPDLogging", | |
"type":"infra", | |
"value":"healthd_httpd_logging" | |
}, | |
{ | |
"name":"HealthdNginxLogging", | |
"type":"infra", | |
"value":"healthd_nginx_logging" | |
}, | |
{ | |
"name":"EbExtensionPreBuild", | |
"type":"infra", | |
"value":"embeddedprebuild" | |
}, | |
{ | |
"name":"AppDeployPreHook", | |
"type":"hook", | |
"value":"appdeploy\/pre" | |
}, | |
{ | |
"name":"EbExtensionPostBuild", | |
"type":"infra", | |
"value":"embeddedpostbuild" | |
}, | |
{ | |
"name":"InfraCleanEbExtension", | |
"type":"infra", | |
"value":"cleanebextensions" | |
} | |
] | |
}, | |
{ | |
"name":"StartupStage1", | |
"actions":[ | |
{ | |
"name":"AppDeployEnactHook", | |
"type":"hook", | |
"value":"appdeploy\/enact" | |
}, | |
{ | |
"name":"AppDeployPostHook", | |
"type":"hook", | |
"value":"appdeploy\/post" | |
}, | |
{ | |
"name":"PostInitHook", | |
"type":"hook", | |
"value":"postinit" | |
} | |
] | |
} | |
] | |
}, | |
"CMD-PublishLogs":{ | |
"stages":[ | |
{ | |
"name":"PublishLogs", | |
"actions":[ | |
{ | |
"name":"PublishLogs", | |
"type":"sh", | |
"value":"publishLogs.py --de-dupe --conf-path '\/opt\/elasticbeanstalk\/tasks\/publishlogs.d\/*' --location-prefix 'resources\/environments\/logs\/publish\/' --num-concurrent 2" | |
} | |
] | |
} | |
] | |
}, | |
"CMD-AppDeploy":{ | |
"stages":[ | |
{ | |
"name":"AppDeployStage0", | |
"actions":[ | |
{ | |
"name":"InfraWriteConfig", | |
"type":"infra", | |
"value":"writeruntimeconfig" | |
}, | |
{ | |
"name":"InfraWriteApp1", | |
"type":"infra", | |
"value":"writeapplication1" | |
}, | |
{ | |
"name":"InfraWriteApp2", | |
"type":"infra", | |
"value":"writeapplication2" | |
}, | |
{ | |
"name":"EbExtensionPreBuild", | |
"type":"infra", | |
"value":"embeddedprebuild" | |
}, | |
{ | |
"name":"AppDeployPreHook", | |
"type":"hook", | |
"value":"appdeploy\/pre" | |
}, | |
{ | |
"name":"EbExtensionPostBuild", | |
"type":"infra", | |
"value":"embeddedpostbuild" | |
}, | |
{ | |
"name":"InfraCleanEbextension", | |
"type":"infra", | |
"value":"cleanebextensions" | |
} | |
] | |
}, | |
{ | |
"name":"AppDeployStage1", | |
"actions":[ | |
{ | |
"name":"AppDeployEnactHook", | |
"type":"hook", | |
"value":"appdeploy\/enact" | |
}, | |
{ | |
"name":"AppDeployPostHook", | |
"type":"hook", | |
"value":"appdeploy\/post" | |
} | |
] | |
} | |
] | |
}, | |
"CMD-BundleLogs":{ | |
"stages":[ | |
{ | |
"name":"BundleLogs", | |
"actions":[ | |
{ | |
"name":"BundleLogs", | |
"type":"sh", | |
"value":"bundleLogs.py --conf-path '\/opt\/elasticbeanstalk\/tasks\/bundlelogs.d\/*' --location-prefix 'resources\/environments\/logs\/bundle\/'" | |
} | |
] | |
} | |
] | |
}, | |
"CMD-SelfStartup":{ | |
"stages":[ | |
{ | |
"name":"StartupStage0", | |
"actions":[ | |
{ | |
"name":"HealthdLogRotation", | |
"type":"infra", | |
"value":"healthd_log_rotation" | |
}, | |
{ | |
"name":"HealthdHTTPDLogging", | |
"type":"infra", | |
"value":"healthd_httpd_logging" | |
}, | |
{ | |
"name":"HealthdNginxLogging", | |
"type":"infra", | |
"value":"healthd_nginx_logging" | |
}, | |
{ | |
"name":"EbExtensionPreBuild", | |
"type":"infra", | |
"value":"embeddedprebuild" | |
}, | |
{ | |
"name":"AppDeployPreHook", | |
"type":"hook", | |
"value":"appdeploy\/pre" | |
}, | |
{ | |
"name":"EbExtensionPostBuild", | |
"type":"infra", | |
"value":"embeddedpostbuild" | |
}, | |
{ | |
"name":"InfraCleanEbextension", | |
"type":"infra", | |
"value":"cleanebextensions" | |
} | |
] | |
}, | |
{ | |
"name":"StartupStage1", | |
"actions":[ | |
{ | |
"name":"AppDeployEnactHook", | |
"type":"hook", | |
"value":"appdeploy\/enact" | |
}, | |
{ | |
"name":"AppDeployPostHook", | |
"type":"hook", | |
"value":"appdeploy\/post" | |
}, | |
{ | |
"name":"PostInitHook", | |
"type":"hook", | |
"value":"postinit" | |
} | |
] | |
} | |
] | |
}, | |
"CMD-SystemTailLogs":{ | |
"stages":[ | |
{ | |
"name":"SystemTailLogs", | |
"actions":[ | |
{ | |
"name":"SystemTailLogs", | |
"type":"sh", | |
"value":"tailLogs.py --concatenate --conf-path '\/opt\/elasticbeanstalk\/tasks\/systemtaillogs.d\/*' --location-prefix 'resources\/environments\/logs\/systemtail\/'" | |
} | |
] | |
} | |
] | |
}, | |
"CMD-RestartAppServer":{ | |
"stages":[ | |
{ | |
"name":"RestartAppServerStage0", | |
"actions":[ | |
{ | |
"name":"InfraWriteConfig", | |
"type":"infra", | |
"value":"writeruntimeconfig" | |
}, | |
{ | |
"name":"RestartAppServerPreHook", | |
"type":"hook", | |
"value":"restartappserver\/pre" | |
} | |
] | |
}, | |
{ | |
"name":"RestartAppServerStage1", | |
"actions":[ | |
{ | |
"name":"RestartAppServerEnactHook", | |
"type":"hook", | |
"value":"restartappserver\/enact" | |
}, | |
{ | |
"name":"RestartAppServerPostHook", | |
"type":"hook", | |
"value":"restartappserver\/post" | |
} | |
] | |
} | |
] | |
}, | |
"CMD-ConfigDeploy":{ | |
"stages":[ | |
{ | |
"name":"ConfigDeployStage0", | |
"actions":[ | |
{ | |
"name":"InfraWriteConfig", | |
"type":"infra", | |
"value":"writeruntimeconfig" | |
}, | |
{ | |
"name":"ConfigDeployPreHook", | |
"type":"hook", | |
"value":"configdeploy\/pre" | |
} | |
] | |
}, | |
{ | |
"name":"ConfigDeployStage1", | |
"actions":[ | |
{ | |
"name":"ConfigDeployEnactHook", | |
"type":"hook", | |
"value":"configdeploy\/enact" | |
}, | |
{ | |
"name":"ConfigDeployPostHook", | |
"type":"hook", | |
"value":"configdeploy\/post" | |
} | |
] | |
} | |
] | |
} | |
} | |
}, | |
"_API":{ | |
"_Commands":{ | |
"CMD-TailLogs":{ | |
"_Stages":{ | |
"01_enact":[ | |
"InfoTask-TailLogs" | |
] | |
} | |
}, | |
"CMD-Startup":{ | |
"_RunStaged":"true", | |
"_Stages":{ | |
"01_pre":[ | |
], | |
"02_enact":[ | |
] | |
} | |
}, | |
"CMD-AppDeploy":{ | |
"_RunStaged":"true", | |
"_Stages":{ | |
"01_pre":[ | |
], | |
"02_enact":[ | |
] | |
} | |
}, | |
"CMD-BundleLogs":{ | |
"_Stages":{ | |
"01_enact":[ | |
"InfoTask-BundleLogs" | |
] | |
} | |
}, | |
"CMD-SystemTailLogs":{ | |
"_Stages":{ | |
"01_enact":[ | |
"InfoTask-SystemTailLogs" | |
] | |
} | |
}, | |
"CMD-PatchInstance":{ | |
"_Stages":{ | |
"01_enact":[ | |
"_Infra-PatchInstance" | |
] | |
} | |
}, | |
"CMD-RestartAppServer":{ | |
"_RunStaged":"false", | |
"_Stages":{ | |
"01_enact":[ | |
], | |
"02_enact":[ | |
] | |
} | |
}, | |
"CMD-ConfigDeploy":{ | |
"_RunStaged":"true", | |
"_Stages":{ | |
"01_pre":[ | |
], | |
"02_enact":[ | |
] | |
} | |
} | |
} | |
}, | |
"AvailabilityZoneCount":"Any 1", | |
"_EnvironmentInfoTaskMapping":"EnvironmentInfoTasks" | |
} | |
}, | |
"Type":"AWS::AutoScaling::AutoScalingGroup", | |
"DependsOn":"AWSEBBeanstalkMetadata", | |
"UpdatePolicy":{ | |
"AutoScalingRollingUpdate":{ | |
"MinInstancesInService":"1", | |
"PauseTime":"PT30M", | |
"MaxBatchSize":"1", | |
"WaitOnResourceSignals":"true" | |
} | |
}, | |
"Properties":{ | |
"LoadBalancerNames":[ | |
{ | |
"Ref":"AWSEBLoadBalancer" | |
} | |
], | |
"MinSize":"1", | |
"LaunchConfigurationName":{ | |
"Ref":"AWSEBAutoScalingLaunchConfiguration" | |
}, | |
"AvailabilityZones":[ | |
"ap-southeast-2b", | |
"ap-southeast-2a" | |
], | |
"Cooldown":"360", | |
"VPCZoneIdentifier":[ | |
"subnet-1c38e46b", | |
"subnet-351a9550" | |
], | |
"MaxSize":"3", | |
"Tags":[ | |
{ | |
"Value":{ | |
"Ref":"AWSEBEnvironmentName" | |
}, | |
"Key":"elasticbeanstalk:environment-name", | |
"PropagateAtLaunch":true | |
}, | |
{ | |
"Value":{ | |
"Ref":"AWSEBEnvironmentName" | |
}, | |
"Key":"Name", | |
"PropagateAtLaunch":true | |
}, | |
{ | |
"Value":{ | |
"Ref":"AWSEBEnvironmentId" | |
}, | |
"Key":"elasticbeanstalk:environment-id", | |
"PropagateAtLaunch":true | |
} | |
] | |
} | |
}, | |
"AWSEBUpdateWaitConditionHandlexwaxZO":{ | |
"Type":"AWS::CloudFormation::WaitConditionHandle" | |
}, | |
"AWSEBInstanceLaunchWaitCondition":{ | |
"Type":"AWS::CloudFormation::WaitCondition", | |
"DependsOn":"AWSEBAutoScalingGroup", | |
"Properties":{ | |
"Timeout":"900", | |
"Count":"1", | |
"Handle":{ | |
"Ref":"AWSEBInstanceLaunchWaitHandle" | |
} | |
} | |
}, | |
"AWSEBAutoScalingScaleUpPolicy":{ | |
"Properties":{ | |
"ScalingAdjustment":"1", | |
"AutoScalingGroupName":{ | |
"Ref":"AWSEBAutoScalingGroup" | |
}, | |
"AdjustmentType":"ChangeInCapacity" | |
}, | |
"Type":"AWS::AutoScaling::ScalingPolicy" | |
}, | |
"AWSEBCloudwatchAlarmHigh":{ | |
"Properties":{ | |
"AlarmActions":[ | |
{ | |
"Ref":"AWSEBAutoScalingScaleUpPolicy" | |
} | |
], | |
"MetricName":"NetworkOut", | |
"ComparisonOperator":"GreaterThanThreshold", | |
"Statistic":"Average", | |
"AlarmDescription":"ElasticBeanstalk Default Scale Up alarm", | |
"Period":"300", | |
"Dimensions":[ | |
{ | |
"Value":{ | |
"Ref":"AWSEBAutoScalingGroup" | |
}, | |
"Name":"AutoScalingGroupName" | |
} | |
], | |
"EvaluationPeriods":"1", | |
"Namespace":"AWS\/EC2", | |
"Threshold":"6000000" | |
}, | |
"Type":"AWS::CloudWatch::Alarm" | |
}, | |
"AWSEBBeanstalkMetadata":{ | |
"Metadata":{ | |
"AWS::ElasticBeanstalk::Ext":{ | |
"Parameters":{ | |
"LogPublicationControl":{ | |
"Ref":"LogPublicationControl" | |
}, | |
"DocumentRoot":{ | |
"Ref":"DocumentRoot" | |
}, | |
"InstancePort":{ | |
"Ref":"InstancePort" | |
}, | |
"DisplayErrors":{ | |
"Ref":"DisplayErrors" | |
}, | |
"AWSEBEnvironmentId":{ | |
"Ref":"AWSEBEnvironmentId" | |
}, | |
"HooksPkgUrl":{ | |
"Ref":"HooksPkgUrl" | |
}, | |
"ZlibOutputCompression":{ | |
"Ref":"ZlibOutputCompression" | |
}, | |
"AWSEBEnvironmentName":{ | |
"Ref":"AWSEBEnvironmentName" | |
}, | |
"AWSEBReferrerId":{ | |
"Ref":"AWSEBReferrerId" | |
}, | |
"AppSource":{ | |
"Ref":"AppSource" | |
}, | |
"MaxExecutionTime":{ | |
"Ref":"MaxExecutionTime" | |
}, | |
"MemoryLimit":{ | |
"Ref":"MemoryLimit" | |
}, | |
"EnvironmentVariables":{ | |
"Ref":"EnvironmentVariables" | |
}, | |
"AllowUrlFopen":{ | |
"Ref":"AllowUrlFopen" | |
}, | |
"AWSEBAgentId":{ | |
"Ref":"AWSEBAgentId" | |
}, | |
"ComposerOptions":{ | |
"Ref":"ComposerOptions" | |
}, | |
"InstanceType":{ | |
"Ref":"InstanceType" | |
}, | |
"AWSEBEnvironmentBucket":{ | |
"Ref":"AWSEBEnvironmentBucket" | |
} | |
} | |
}, | |
"AWS::ElasticBeanstalk::Metadata":{ | |
"EnvironmentId":"e-pyxpmc6mnq", | |
"RequestId":"9496a487-88d5-11e5-8ac1-01d9254ba1bc", | |
"Version":"9496a487-88d5-11e5-8ac1-01d9254ba1bc", | |
"EnvironmentName":"production", | |
"DateUpdated":"2015-11-12T00:37:40", | |
"DateCreated":"2015-09-21T11:37:58", | |
"DateLastModified":"2015-11-12T00:37:46", | |
"Name":"e-pyxpmc6mnq" | |
} | |
}, | |
"Type":"AWS::CloudFormation::WaitConditionHandle" | |
}, | |
"AWSEBCloudwatchAlarmLow":{ | |
"Properties":{ | |
"AlarmActions":[ | |
{ | |
"Ref":"AWSEBAutoScalingScaleDownPolicy" | |
} | |
], | |
"MetricName":"NetworkOut", | |
"ComparisonOperator":"LessThanThreshold", | |
"Statistic":"Average", | |
"AlarmDescription":"ElasticBeanstalk Default Scale Down alarm", | |
"Period":"300", | |
"Dimensions":[ | |
{ | |
"Value":{ | |
"Ref":"AWSEBAutoScalingGroup" | |
}, | |
"Name":"AutoScalingGroupName" | |
} | |
], | |
"EvaluationPeriods":"1", | |
"Namespace":"AWS\/EC2", | |
"Threshold":"2000000" | |
}, | |
"Type":"AWS::CloudWatch::Alarm" | |
} | |
}, | |
"Description":"AWS Elastic Beanstalk environment (Name: 'production' Id: 'e-pyxpmc6mnq')", | |
"Mappings":{ | |
"AWSEBAWSRegionArch2AMIBase":{ | |
"cn-north-1":{ | |
"pv":"ami-54b22e6d", | |
"graphics":"", | |
"gpu":"", | |
"hvm":"ami-64b22e5d" | |
}, | |
"eu-west-1":{ | |
"pv":"ami-a3be93d4", | |
"graphics":"ami-358ca042", | |
"gpu":"", | |
"hvm":"ami-a1be93d6" | |
}, | |
"ap-southeast-1":{ | |
"pv":"ami-50978202", | |
"graphics":"ami-4e7e6a1c", | |
"gpu":"", | |
"hvm":"ami-56978204" | |
}, | |
"ap-southeast-2":{ | |
"pv":"ami-c71856fd", | |
"graphics":"ami-156f212f", | |
"gpu":"", | |
"hvm":"ami-c51856ff" | |
}, | |
"eu-central-1":{ | |
"pv":"ami-a6aeaebb", | |
"graphics":"", | |
"gpu":"", | |
"hvm":"ami-d6aeaecb" | |
}, | |
"ap-northeast-1":{ | |
"pv":"ami-9c2fb89c", | |
"graphics":"ami-7c50c17c", | |
"gpu":"", | |
"hvm":"ami-9e2fb89e" | |
}, | |
"us-east-1":{ | |
"pv":"ami-cf1066aa", | |
"graphics":"ami-8ba3d3ee", | |
"gpu":"", | |
"hvm":"ami-d71066b2" | |
}, | |
"sa-east-1":{ | |
"pv":"ami-370c992a", | |
"graphics":"", | |
"gpu":"", | |
"hvm":"ami-310c992c" | |
}, | |
"us-west-1":{ | |
"pv":"ami-d53aff91", | |
"graphics":"ami-17985c53", | |
"gpu":"", | |
"hvm":"ami-cb3aff8f" | |
}, | |
"us-west-2":{ | |
"pv":"ami-81f7e8b1", | |
"graphics":"ami-99352ba9", | |
"gpu":"", | |
"hvm":"ami-83f7e8b3" | |
} | |
}, | |
"AWSEBOptions":{ | |
"options":{ | |
"AWSEBHealthdGroupId":"11be8185-c2a0-45e5-bd8c-2b798ed1cb41", | |
"HaltStartupCommandsOnFailure":"true", | |
"SystemType":"enhanced", | |
"UserDataScript":"https:\/\/s3-ap-southeast-2.amazonaws.com\/elasticbeanstalk-env-resources-ap-southeast-2\/stalks\/eb_php_4.0.1.22.8\/lib\/UserDataScript.sh", | |
"LaunchType":"Migration", | |
"ebgems":"https:\/\/s3-ap-southeast-2.amazonaws.com\/elasticbeanstalk-env-resources-ap-southeast-2\/stalks\/eb_php_4.0.1.22.8\/lib\/beanstalk-core-2.1.gem https:\/\/s3-ap-southeast-2.amazonaws.com\/elasticbeanstalk-env-resources-ap-southeast-2\/stalks\/eb_php_4.0.1.22.8\/lib\/beanstalk-core-healthd-1.1.gem https:\/\/s3-ap-southeast-2.amazonaws.com\/elasticbeanstalk-env-resources-ap-southeast-2\/stalks\/eb_php_4.0.1.22.8\/lib\/executor-1.1.gem", | |
"tarballs":"https:\/\/s3-ap-southeast-2.amazonaws.com\/elasticbeanstalk-env-resources-ap-southeast-2\/stalks\/eb_php_4.0.1.22.8\/lib\/awseb-ruby-2.2.2-x86_64-20150919_0250.tar.gz", | |
"rpms":"https:\/\/s3-ap-southeast-2.amazonaws.com\/elasticbeanstalk-env-resources-ap-southeast-2\/stalks\/eb_php_4.0.1.22.8\/lib\/aws-cfn-bootstrap-1.4-7_eb.noarch.rpm https:\/\/s3-ap-southeast-2.amazonaws.com\/elasticbeanstalk-env-resources-ap-southeast-2\/stalks\/eb_php_4.0.1.22.8\/lib\/aws-elasticbeanstalk-tools-1.16-1.noarch.rpm", | |
"PhpVersion":"5.6", | |
"FastVersionDeployment":"true", | |
"ServiceRole":"aws-elasticbeanstalk-service-role", | |
"HealthdProxyLogLocation":"", | |
"CommandBasedLeaderElection":"true", | |
"CloudConfigOptions":"cloud_final_modules:\n - [scripts-user, always]", | |
"LeaderTestScript":"\/opt\/elasticbeanstalk\/bin\/leader-test.sh", | |
"DefaultsScript":"\/opt\/elasticbeanstalk\/support\/containerDefaults", | |
"downloadSourceBundleScriptLocation":[ | |
"https:\/\/elasticbeanstalk-env-resources-ap-southeast-2.s3.amazonaws.com\/eb_patching_resources\/download_source_bundle.py" | |
], | |
"DefaultSSHPort":"22", | |
"ProxyServer":"httpd", | |
"AWSEBHealthdEndpoint":"", | |
"EmbeddedConfigsetsEnabled":"true", | |
"EBSNSTopicArn":"arn:aws:sns:ap-southeast-2:<account-id>:ElasticBeanstalkNotifications-Environment-production", | |
"guid":"1ccace57c6e3", | |
"nodeploymentOnStartup":"true", | |
"ebpatchscripturl":[ | |
"https:\/\/s3-ap-southeast-2.amazonaws.com\/elasticbeanstalk-env-resources-ap-southeast-2\/eb_patching_resources\/patch_instance.py" | |
] | |
} | |
}, | |
"AWSEBAWSRegionArch2AMI":{ | |
"cn-north-1":{ | |
"pv":"ami-54b22e6d", | |
"graphics":"", | |
"gpu":"", | |
"hvm":"ami-64b22e5d" | |
}, | |
"eu-west-1":{ | |
"pv":"ami-a3be93d4", | |
"graphics":"ami-358ca042", | |
"gpu":"", | |
"hvm":"ami-a1be93d6" | |
}, | |
"ap-southeast-1":{ | |
"pv":"ami-50978202", | |
"graphics":"ami-4e7e6a1c", | |
"gpu":"", | |
"hvm":"ami-56978204" | |
}, | |
"ap-southeast-2":{ | |
"pv":"ami-b0c897d3", | |
"graphics":"ami-89790ab3", | |
"gpu":"", | |
"hvm":"ami-f8c59a9b" | |
}, | |
"eu-central-1":{ | |
"pv":"ami-a6aeaebb", | |
"graphics":"", | |
"gpu":"", | |
"hvm":"ami-d6aeaecb" | |
}, | |
"ap-northeast-1":{ | |
"pv":"ami-9c2fb89c", | |
"graphics":"ami-7c50c17c", | |
"gpu":"", | |
"hvm":"ami-9e2fb89e" | |
}, | |
"us-east-1":{ | |
"pv":"ami-cf1066aa", | |
"graphics":"ami-8ba3d3ee", | |
"gpu":"", | |
"hvm":"ami-d71066b2" | |
}, | |
"sa-east-1":{ | |
"pv":"ami-370c992a", | |
"graphics":"", | |
"gpu":"", | |
"hvm":"ami-310c992c" | |
}, | |
"us-west-1":{ | |
"pv":"ami-d53aff91", | |
"graphics":"ami-17985c53", | |
"gpu":"", | |
"hvm":"ami-cb3aff8f" | |
}, | |
"us-west-2":{ | |
"pv":"ami-81f7e8b1", | |
"graphics":"ami-99352ba9", | |
"gpu":"", | |
"hvm":"ami-83f7e8b3" | |
} | |
}, | |
"AWSEBAWSInstanceType2Arch":{ | |
"r3.8xlarge":{ | |
"Arch":"hvm" | |
}, | |
"m3.xlarge":{ | |
"Arch":"pv" | |
}, | |
"m4.10xlarge":{ | |
"Arch":"hvm" | |
}, | |
"m1.small":{ | |
"Arch":"pv" | |
}, | |
"m1.xlarge":{ | |
"Arch":"pv" | |
}, | |
"m2.xlarge":{ | |
"Arch":"pv" | |
}, | |
"m4.xlarge":{ | |
"Arch":"hvm" | |
}, | |
"g2.2xlarge":{ | |
"Arch":"graphics" | |
}, | |
"m4.2xlarge":{ | |
"Arch":"hvm" | |
}, | |
"c3.4xlarge":{ | |
"Arch":"hvm" | |
}, | |
"t2.large":{ | |
"Arch":"hvm" | |
}, | |
"c1.medium":{ | |
"Arch":"pv" | |
}, | |
"c4.2xlarge":{ | |
"Arch":"hvm" | |
}, | |
"m2.2xlarge":{ | |
"Arch":"pv" | |
}, | |
"hi1.4xlarge":{ | |
"Arch":"pv" | |
}, | |
"t1.micro":{ | |
"Arch":"pv" | |
}, | |
"g2.8xlarge":{ | |
"Arch":"graphics" | |
}, | |
"m1.large":{ | |
"Arch":"pv" | |
}, | |
"r3.2xlarge":{ | |
"Arch":"hvm" | |
}, | |
"t2.micro":{ | |
"Arch":"hvm" | |
}, | |
"hs1.8xlarge":{ | |
"Arch":"pv" | |
}, | |
"m2.4xlarge":{ | |
"Arch":"pv" | |
}, | |
"cc2.8xlarge":{ | |
"Arch":"hvm" | |
}, | |
"m4.large":{ | |
"Arch":"hvm" | |
}, | |
"i2.xlarge":{ | |
"Arch":"hvm" | |
}, | |
"m4.4xlarge":{ | |
"Arch":"hvm" | |
}, | |
"c4.8xlarge":{ | |
"Arch":"hvm" | |
}, | |
"t2.medium":{ | |
"Arch":"hvm" | |
}, | |
"i2.2xlarge":{ | |
"Arch":"hvm" | |
}, | |
"i2.8xlarge":{ | |
"Arch":"hvm" | |
}, | |
"c4.large":{ | |
"Arch":"hvm" | |
}, | |
"r3.xlarge":{ | |
"Arch":"hvm" | |
}, | |
"cc1.4xlarge":{ | |
"Arch":"hvm" | |
}, | |
"r3.large":{ | |
"Arch":"hvm" | |
}, | |
"t2.small":{ | |
"Arch":"hvm" | |
}, | |
"c4.4xlarge":{ | |
"Arch":"hvm" | |
}, | |
"m3.2xlarge":{ | |
"Arch":"pv" | |
}, | |
"c1.xlarge":{ | |
"Arch":"pv" | |
}, | |
"c3.xlarge":{ | |
"Arch":"hvm" | |
}, | |
"c4.xlarge":{ | |
"Arch":"hvm" | |
}, | |
"cr1.8xlarge":{ | |
"Arch":"hvm" | |
}, | |
"m3.medium":{ | |
"Arch":"pv" | |
}, | |
"m1.medium":{ | |
"Arch":"pv" | |
}, | |
"c3.2xlarge":{ | |
"Arch":"hvm" | |
}, | |
"c3.large":{ | |
"Arch":"hvm" | |
}, | |
"i2.4xlarge":{ | |
"Arch":"hvm" | |
}, | |
"m3.large":{ | |
"Arch":"pv" | |
}, | |
"c3.8xlarge":{ | |
"Arch":"hvm" | |
}, | |
"r3.4xlarge":{ | |
"Arch":"hvm" | |
} | |
}, | |
"EnvironmentInfoTasks":{ | |
"systemtail":{ | |
"LocationPrefix":"resources\/environments\/logs\/systemtail\/", | |
"AutoClean":"true", | |
"CommandName":"CMD-SystemTailLogs" | |
}, | |
"tail":{ | |
"LocationPrefix":"resources\/environments\/logs\/tail\/", | |
"AutoClean":"true", | |
"CommandName":"CMD-TailLogs" | |
}, | |
"publish":{ | |
"LocationPrefix":"resources\/environments\/logs\/publish\/" | |
}, | |
"bundle":{ | |
"LocationPrefix":"resources\/environments\/logs\/bundle\/", | |
"AutoClean":"true", | |
"CommandName":"CMD-BundleLogs" | |
} | |
}, | |
"ContainerMeta":{ | |
"AMIMeta":{ | |
"RepoReleaseVersion":"2015.09", | |
"AMIVersion":"2015.09.0" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment