-
Notifications
You must be signed in to change notification settings - Fork 262
/
Copy pathElasticBeanstalk_Simple.template
142 lines (130 loc) · 5.24 KB
/
ElasticBeanstalk_Simple.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS CloudFormation Sample Template ElasticBeanstalk_Simple: Configure and launch an AWS Elastic Beanstalk application that connects to an Amazon RDS database instance. Monitoring is setup on the database. **WARNING** This template creates one or more Amazon EC2 instances and an Amazon Relational Database Service database instance. You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters" : {
"DatabaseUser": {
"Default": "admin",
"NoEcho": "true",
"Type": "String",
"Description" : "Test database admin account name",
"MinLength": "1",
"MaxLength": "16",
"AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*",
"ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters."
},
"DatabasePassword": {
"Default": "password",
"NoEcho": "true",
"Type": "String",
"Description" : "Test database admin account password",
"MinLength": "8",
"MaxLength": "41",
"AllowedPattern" : "[a-zA-Z0-9]*",
"ConstraintDescription" : "must contain only alphanumeric characters."
},
"OperatorEmail": {
"Default": "nobody@amazon.com",
"Description": "Email address to notify if there are any operational issues",
"Type": "String"
}
},
"Resources" : {
"SampleApplication" : {
"Type" : "AWS::ElasticBeanstalk::Application",
"Properties" : {
"Description" : "AWS Elastic Beanstalk Sample Application",
"ApplicationVersions" : [{
"VersionLabel" : "Initial Version",
"Description" : "Version 1.0",
"SourceBundle" : {
"S3Bucket" : { "Fn::Join" : ["-", ["cloudformation-samples", { "Ref" : "AWS::Region" }]]},
"S3Key" : "CloudFormationBeanstalkRDSExample.war"
}
}],
"ConfigurationTemplates" : [{
"TemplateName" : "DefaultConfiguration",
"Description" : "Default Configuration Version 1.0 - with SSH access",
"SolutionStackName" : "64bit Amazon Linux running Tomcat 7",
"OptionSettings" : [{
"Namespace" : "aws:elasticbeanstalk:application:environment",
"OptionName" : "JDBC_CONNECTION_STRING",
"Value" : { "Fn::Join": [ "", [ "jdbc:mysql://",
{ "Fn::GetAtt": [ "SampleDB", "Endpoint.Address" ] },
":",
{ "Fn::GetAtt": [ "SampleDB", "Endpoint.Port" ] },
"/beanstalkdb" ]]}
},{
"Namespace" : "aws:elasticbeanstalk:application:environment",
"OptionName" : "PARAM1",
"Value" : { "Ref" : "DatabaseUser" }
},{
"Namespace" : "aws:elasticbeanstalk:application:environment",
"OptionName" : "PARAM2",
"Value" : { "Ref" : "DatabasePassword" }
}]
}]
}
},
"SampleEnvironment" : {
"Type" : "AWS::ElasticBeanstalk::Environment",
"Properties" : {
"ApplicationName" : { "Ref" : "SampleApplication" },
"Description" : "AWS Elastic Beanstalk Environment running Sample Application",
"TemplateName" : "DefaultConfiguration",
"VersionLabel" : "Initial Version"
}
},
"DBSecurityGroup": {
"Type": "AWS::RDS::DBSecurityGroup",
"Properties": {
"DBSecurityGroupIngress": {
"EC2SecurityGroupName": "elasticbeanstalk-default"
},
"GroupDescription": "database access"
}
},
"SampleDB": {
"Type": "AWS::RDS::DBInstance",
"Properties": {
"Engine": "MySQL",
"DBName": "beanstalkdb",
"MasterUsername": { "Ref": "DatabaseUser" },
"DBInstanceClass": "db.m1.small",
"DBSecurityGroups": [{ "Ref": "DBSecurityGroup" }],
"AllocatedStorage": "5",
"MasterUserPassword": { "Ref": "DatabasePassword" }
}
},
"AlarmTopic": {
"Type": "AWS::SNS::Topic",
"Properties": {
"Subscription": [{ "Endpoint": { "Ref": "OperatorEmail" }, "Protocol": "email" }]
}
},
"CPUAlarmHigh": {
"Type" : "AWS::CloudWatch::Alarm",
"Properties": {
"EvaluationPeriods": "10",
"Statistic": "Average",
"Threshold": "50",
"AlarmDescription": "Alarm if CPU too high or metric disappears indicating the RDS database instance is having issues",
"Period": "60",
"Namespace": "AWS/RDS",
"MetricName": "CPUUtilization",
"Dimensions": [ {
"Name": "DBInstanceIdentifier",
"Value": { "Ref": "SampleDB" }
} ],
"ComparisonOperator": "GreaterThanThreshold",
"AlarmActions": [ { "Ref": "AlarmTopic" } ],
"InsufficientDataActions": [ { "Ref": "AlarmTopic" } ]
}
}
},
"Outputs" : {
"URL" : {
"Description" : "URL of the AWS Elastic Beanstalk Environment",
"Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : [ "SampleEnvironment", "EndpointURL" ] }]]}
}
}
}