Skip to content

Commit 8411846

Browse files
author
David Huntsperger
committed
initial commit
1 parent 74d466b commit 8411846

File tree

908 files changed

+101967
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

908 files changed

+101967
-0
lines changed

doc_source/CHAP_TemplateQuickRef.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Template Snippets<a name="CHAP_TemplateQuickRef"></a>
2+
3+
This section provides a number of example scenarios that you can use to understand how to declare various AWS CloudFormation template parts\. You can also use the snippets as a starting point for sections of your custom templates\.
4+
5+
6+
+ [General Template Snippets](quickref-general.md)
7+
+ [Auto Scaling Template Snippets](quickref-autoscaling.md)
8+
+ [AWS CloudFormation Template Snippets](quickref-cloudformation.md)
9+
+ [Amazon CloudFront Template Snippets](quickref-cloudfront.md)
10+
+ [Amazon CloudWatch Template Snippets](quickref-cloudwatch.md)
11+
+ [Amazon CloudWatch Logs Template Snippets](quickref-cloudwatchlogs.md)
12+
+ [Amazon DynamoDB Template Snippets](quickref-dynamodb.md)
13+
+ [Amazon EC2 Template Snippets](quickref-ec2.md)
14+
+ [Amazon Elastic Container Service Template Snippets](quickref-ecs.md)
15+
+ [Amazon Elastic File System Sample Template](quickref-efs.md)
16+
+ [Elastic Beanstalk Template Snippets](quickref-elasticbeanstalk.md)
17+
+ [Elastic Load Balancing Template Snippets](quickref-elb.md)
18+
+ [AWS Identity and Access Management Template Snippets](quickref-iam.md)
19+
+ [AWS Lambda Template](quickref-lambda.md)
20+
+ [AWS OpsWorks Template Snippets](quickref-opsworks.md)
21+
+ [Amazon Redshift Template Snippets](quickref-redshift.md)
22+
+ [Amazon RDS Template Snippets](quickref-rds.md)
23+
+ [Route 53 Template Snippets](quickref-route53.md)
24+
+ [Amazon S3 Template Snippets](quickref-s3.md)
25+
+ [Amazon SNS Template Snippets](quickref-sns.md)
26+
+ [Amazon SQS Template Snippets](scenario-sqs-queue.md)

doc_source/CHAP_Using.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Walkthroughs<a name="CHAP_Using"></a>
2+
3+
Templates are JSON\- or YAML\-formatted text files that describe the AWS resources that you want to provision or update in your AWS CloudFormation stacks\. To create templates, you can use AWS CloudFormation Designer or a text editor\.
4+
5+
The following walkthroughs show how to create sample AWS CloudFormation templates using AWS CloudFormation Designer and plain text\.
6+
7+
8+
+ [Walkthrough: Use AWS CloudFormation Designer to Create a Basic Web Server](working-with-templates-cfn-designer-walkthrough-createbasicwebserver.md)
9+
+ [Walkthrough: Use AWS CloudFormation Designer to Modify a Stack's Template](working-with-templates-cfn-designer-walkthrough-updatebasicwebserver.md)
10+
+ [Walkthrough: Peer with an Amazon VPC in Another AWS Account](peer-with-vpc-in-another-account.md)
11+
+ [Walkthrough: Refer to Resource Outputs in Another AWS CloudFormation Stack](walkthrough-crossstackref.md)
12+
+ [Walkthrough: Create a Scalable, Load\-balancing Web Server](example-templates-autoscaling.md)
13+
+ [Deploying Applications on Amazon EC2 with AWS CloudFormation](deploying.applications.md)
14+
+ [Creating Wait Conditions in a Template](using-cfn-waitcondition.md)

doc_source/GettingStarted.Walkthrough.md

Lines changed: 376 additions & 0 deletions
Large diffs are not rendered by default.

doc_source/GettingStarted.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Getting Started with AWS CloudFormation<a name="GettingStarted"></a>
2+
3+
Because you can use AWS CloudFormation to launch many different types of resources, the getting started walkthrough will touch on just a few simple concepts to help you get an idea of how to use AWS CloudFormation\.
4+
5+
In this section, you will use the AWS Management Console to create a stack from an example template from the [AWS CloudFormation Sample Template Library](http://aws.amazon.com/cloudformation/aws-cloudformation-templates/) and learn the basics of creating a template\.
6+
7+
In the following walkthrough, we'll use a sample template to launch, update, and delete a stack\. After you learn the fundamentals, you can learn more about creating more complex templates and stacks\.
8+
9+
AWS CloudFormation makes deploying a set of Amazon Web Services \(AWS\) resources as simple as submitting a template\. A *template* is a simple text file that describes a *stack*, a collection of AWS resources you want to deploy together as a group\. You use the template to define all the AWS resources you want in your stack\. This can include Amazon Elastic Compute Cloud instances, Amazon Relational Database Service DB Instances, and other resources\. For a list of resource types, see \.
10+
11+
12+
+ [Get Started](GettingStarted.Walkthrough.md)
13+
+ [Learn Template Basics](gettingstarted.templatebasics.md)
14+
+ [Walkthrough: Updating a Stack](updating.stacks.walkthrough.md)

doc_source/ReleaseHistory.md

Lines changed: 209 additions & 0 deletions
Large diffs are not rendered by default.

doc_source/Welcome.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# What is AWS CloudFormation?<a name="Welcome"></a>
2+
3+
AWS CloudFormation is a service that helps you model and set up your Amazon Web Services resources so that you can spend less time managing those resources and more time focusing on your applications that run in AWS\. You create a template that describes all the AWS resources that you want \(like Amazon EC2 instances or Amazon RDS DB instances\), and AWS CloudFormation takes care of provisioning and configuring those resources for you\. You don't need to individually create and configure AWS resources and figure out what's dependent on what; AWS CloudFormation handles all of that\. The following scenarios demonstrate how AWS CloudFormation can help\.
4+
5+
## Simplify Infrastructure Management<a name="w3ab2b5b5"></a>
6+
7+
For a scalable web application that also includes a back\-end database, you might use an Auto Scaling group, an Elastic Load Balancing load balancer, and an Amazon Relational Database Service database instance\. Normally, you might use each individual service to provision these resources\. And after you create the resources, you would have to configure them to work together\. All these tasks can add complexity and time before you even get your application up and running\.
8+
9+
Instead, you can create or modify an existing AWS CloudFormation template\. A template describes all of your resources and their properties\. When you use that template to create an AWS CloudFormation stack, AWS CloudFormation provisions the Auto Scaling group, load balancer, and database for you\. After the stack has been successfully created, your AWS resources are up and running\. You can delete the stack just as easily, which deletes all the resources in the stack\. By using AWS CloudFormation, you easily manage a collection of resources as a single unit\.
10+
11+
## Quickly Replicate Your Infrastructure<a name="w3ab2b5b7"></a>
12+
13+
If your application requires additional availability, you might replicate it in multiple regions so that if one region becomes unavailable, your users can still use your application in other regions\. The challenge in replicating your application is that it also requires you to replicate your resources\. Not only do you need to record all the resources that your application requires, but you must also provision and configure those resources in each region\.
14+
15+
When you use AWS CloudFormation, you can reuse your template to set up your resources consistently and repeatedly\. Just describe your resources once and then provision the same resources over and over in multiple regions\.
16+
17+
## Easily Control and Track Changes to Your Infrastructure<a name="w3ab2b5b9"></a>
18+
19+
In some cases, you might have underlying resources that you want to upgrade incrementally\. For example, you might change to a higher performing instance type in your Auto Scaling launch configuration so that you can reduce the maximum number of instances in your Auto Scaling group\. If problems occur after you complete the update, you might need to roll back your infrastructure to the original settings\. To do this manually, you not only have to remember which resources were changed, you also have to know what the original settings were\.
20+
21+
When you provision your infrastructure with AWS CloudFormation, the AWS CloudFormation template describes exactly what resources are provisioned and their settings\. Because these templates are text files, you simply track differences in your templates to track changes to your infrastructure, similar to the way developers control revisions to source code\. For example, you can use a version control system with your templates so that you know exactly what changes were made, who made them, and when\. If at any point you need to reverse changes to your infrastructure, you can use a previous version of your template\.
22+
23+
## Related Information<a name="w3ab2b5c13"></a>
24+
25+
+ For more information about AWS CloudFormation stacks and templates, see [AWS CloudFormation Concepts](cfn-whatis-concepts.md)\.
26+
27+
+ For an overview about how to use AWS CloudFormation, see [How Does AWS CloudFormation Work?](cfn-whatis-howdoesitwork.md)\.
28+
29+
+ For pricing information, see [AWS CloudFormation Pricing](http://aws.amazon.com/cloudformation/pricing/)\.
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# CreationPolicy Attribute<a name="aws-attribute-creationpolicy"></a>
2+
3+
Associate the `CreationPolicy` attribute with a resource to prevent its status from reaching create complete until AWS CloudFormation receives a specified number of success signals or the timeout period is exceeded\. To signal a resource, you can use the cfn\-signal helper script or [http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_SignalResource.html](http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_SignalResource.html) API\. AWS CloudFormation publishes valid signals to the stack events so that you track the number of signals sent\.
4+
5+
The creation policy is invoked only when AWS CloudFormation creates the associated resource\. Currently, the only AWS CloudFormation resources that support creation policies are [AWS::AutoScaling::AutoScalingGroup](aws-properties-as-group.md), [AWS::EC2::Instance](aws-properties-ec2-instance.md), and [AWS::CloudFormation::WaitCondition](aws-properties-waitcondition.md)\.
6+
7+
Use the `CreationPolicy` attribute when you want to wait on resource configuration actions before stack creation proceeds\. For example, if you install and configure software applications on an EC2 instance, you might want those applications to be running before proceeding\. In such cases, you can add a `CreationPolicy` attribute to the instance, and then send a success signal to the instance after the applications are installed and configured\. For a detailed example, see [Deploying Applications on Amazon EC2 with AWS CloudFormation](deploying.applications.md)\.
8+
9+
## Syntax<a name="w3ab2c21c23b7b9"></a>
10+
11+
### JSON<a name="aws-attribute-creationpolicy-syntax.json"></a>
12+
13+
```
14+
"CreationPolicy" : {
15+
"[[ERROR] BAD/MISSING LINK TEXT](#cfn-attributes-creationpolicy-autoscalingcreationpolicy)" : {
16+
"[[ERROR] BAD/MISSING LINK TEXT](#cfn-attributes-creationpolicy-autoscalingcreationpolicy-minsuccessfulinstancespercent)" : Integer
17+
},
18+
"[[ERROR] BAD/MISSING LINK TEXT](#cfn-attributes-creationpolicy-resourcesignal)" : {
19+
"[[ERROR] BAD/MISSING LINK TEXT](#cfn-attributes-creationpolicy-resourcesignal-count)" : Integer,
20+
"[[ERROR] BAD/MISSING LINK TEXT](#cfn-attributes-creationpolicy-resourcesignal-timeout)" : String
21+
}
22+
}
23+
```
24+
25+
### YAML<a name="aws-attribute-creationpolicy-syntax.yaml"></a>
26+
27+
```
28+
CreationPolicy:
29+
[[ERROR] BAD/MISSING LINK TEXT](#cfn-attributes-creationpolicy-autoscalingcreationpolicy):
30+
[[ERROR] BAD/MISSING LINK TEXT](#cfn-attributes-creationpolicy-autoscalingcreationpolicy-minsuccessfulinstancespercent): Integer
31+
[[ERROR] BAD/MISSING LINK TEXT](#cfn-attributes-creationpolicy-resourcesignal):
32+
[[ERROR] BAD/MISSING LINK TEXT](#cfn-attributes-creationpolicy-resourcesignal-count): Integer
33+
[[ERROR] BAD/MISSING LINK TEXT](#cfn-attributes-creationpolicy-resourcesignal-timeout): String
34+
```
35+
36+
## CreationPolicy Properties<a name="cfn-attributes-creationpolicy-properties"></a>
37+
38+
`AutoScalingCreationPolicy`
39+
For an Auto Scaling group replacement update, specifies how many instances must signal success for the update to succeed\.
40+
`MinSuccessfulInstancesPercent`
41+
Specifies the percentage of instances in an Auto Scaling replacement update that must signal success for the update to succeed\. You can specify a value from `0` to `100`\. AWS CloudFormation rounds to the nearest tenth of a percent\. For example, if you update five instances with a minimum successful percentage of `50`, three instances must signal success\. If an instance doesn't send a signal within the time specified by the `Timeout` property, AWS CloudFormation assumes that the instance wasn't created\.
42+
*Default*: `100`
43+
*Type*: Integer
44+
*Required: *No
45+
46+
`ResourceSignal`
47+
When AWS CloudFormation creates the associated resource, configures the number of required success signals and the length of time that AWS CloudFormation waits for those signals\.
48+
`Count`
49+
The number of success signals AWS CloudFormation must receive before it sets the resource status as `CREATE_COMPLETE`\. If the resource receives a failure signal or doesn't receive the specified number of signals before the timeout period expires, the resource creation fails and AWS CloudFormation rolls the stack back\.
50+
*Default*: `1`
51+
*Type*: Integer
52+
*Required: *No
53+
`Timeout`
54+
The length of time that AWS CloudFormation waits for the number of signals that was specified in the `Count` property\. The timeout period starts after AWS CloudFormation starts creating the resource, and the timeout expires no sooner than the time you specify but can occur shortly thereafter\. The maximum time that you can specify is 12 hours\.
55+
The value must be in [ISO8601 duration format](http://en.wikipedia.org/wiki/ISO_8601#Durations), in the form: "PT*\#*H*\#*M*\#*S", where each *\#* is the number of hours, minutes, and seconds, respectively\. For best results, specify a period of time that gives your instances plenty of time to get up and running\. A shorter timeout can cause a rollback\.
56+
*Default*: `PT5M` \(5 minutes\)
57+
*Type*: String
58+
*Required: *No
59+
60+
## Examples<a name="w3ab2c21c23b7c13"></a>
61+
62+
### Auto Scaling Group<a name="w3ab2c21c23b7c13b2"></a>
63+
64+
The following example shows how to add a creation policy to an Auto Scaling group\. The creation policy requires three success signals and times out after 15 minutes\.
65+
66+
To have instances wait for an Elastic Load Balancing health check before they signal success, add a health\-check verification by using the [cfn\-init](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-init.html) helper script\. For an example, see the `verify_instance_health` command in the [Auto Scaling rolling updates](https://github.com/awslabs/aws-cloudformation-templates/blob/master/aws/services/AutoScaling/AutoScalingRollingUpdates.yaml) sample template\.
67+
68+
#### JSON<a name="aws-attribute-creationpolicy-example-1.json"></a>
69+
70+
```
71+
"AutoScalingGroup": {
72+
"Type": "AWS::AutoScaling::AutoScalingGroup",
73+
"Properties": {
74+
"AvailabilityZones": { "Fn::GetAZs": "" },
75+
"LaunchConfigurationName": { "Ref": "LaunchConfig" },
76+
"DesiredCapacity": "3",
77+
"MinSize": "1",
78+
"MaxSize": "4"
79+
},
80+
"CreationPolicy": {
81+
"ResourceSignal": {
82+
"Count": "3",
83+
"Timeout": "PT15M"
84+
}
85+
},
86+
"UpdatePolicy" : {
87+
"AutoScalingScheduledAction" : {
88+
"IgnoreUnmodifiedGroupSizeProperties" : "true"
89+
},
90+
"AutoScalingRollingUpdate" : {
91+
"MinInstancesInService" : "1",
92+
"MaxBatchSize" : "2",
93+
"PauseTime" : "PT1M",
94+
"WaitOnResourceSignals" : "true"
95+
}
96+
}
97+
},
98+
"LaunchConfig": {
99+
"Type": "AWS::AutoScaling::LaunchConfiguration",
100+
"Properties": {
101+
"ImageId": "ami-16d18a7e",
102+
"InstanceType": "t2.micro",
103+
"UserData": {
104+
"Fn::Base64": {
105+
"Fn::Join" : [ "", [
106+
"#!/bin/bash -xe\n",
107+
"yum install -y aws-cfn-bootstrap\n",
108+
"/opt/aws/bin/cfn-signal -e 0 --stack ", { "Ref": "AWS::StackName" },
109+
" --resource AutoScalingGroup ",
110+
" --region ", { "Ref" : "AWS::Region" }, "\n"
111+
] ]
112+
}
113+
}
114+
}
115+
}
116+
```
117+
118+
#### YAML<a name="aws-attribute-creationpolicy-example-1.yaml"></a>
119+
120+
```
121+
AutoScalingGroup:
122+
Type: AWS::AutoScaling::AutoScalingGroup
123+
Properties:
124+
AvailabilityZones:
125+
Fn::GetAZs: ''
126+
LaunchConfigurationName:
127+
Ref: LaunchConfig
128+
DesiredCapacity: '3'
129+
MinSize: '1'
130+
MaxSize: '4'
131+
CreationPolicy:
132+
ResourceSignal:
133+
Count: '3'
134+
Timeout: PT15M
135+
UpdatePolicy:
136+
AutoScalingScheduledAction:
137+
IgnoreUnmodifiedGroupSizeProperties: 'true'
138+
AutoScalingRollingUpdate:
139+
MinInstancesInService: '1'
140+
MaxBatchSize: '2'
141+
PauseTime: PT1M
142+
WaitOnResourceSignals: 'true'
143+
LaunchConfig:
144+
Type: AWS::AutoScaling::LaunchConfiguration
145+
Properties:
146+
ImageId: ami-16d18a7e
147+
InstanceType: t2.micro
148+
UserData:
149+
"Fn::Base64":
150+
!Sub |
151+
#!/bin/bash -xe
152+
yum update -y aws-cfn-bootstrap
153+
/opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource AutoScalingGroup --region ${AWS::Region}
154+
```
155+
156+
### WaitCondition<a name="w3ab2c21c23b7c13b4"></a>
157+
158+
The following example shows how to add a creation policy to a wait condition\.
159+
160+
#### JSON<a name="aws-attribute-creationpolicy-example-2.json"></a>
161+
162+
```
163+
"WaitCondition" : {
164+
"Type" : "AWS::CloudFormation::WaitCondition",
165+
"CreationPolicy" : {
166+
"ResourceSignal" : {
167+
"Timeout" : "PT15M",
168+
"Count" : "5"
169+
}
170+
}
171+
}
172+
```
173+
174+
#### YAML<a name="aws-attribute-creationpolicy-example-2.yaml"></a>
175+
176+
```
177+
WaitCondition:
178+
Type: AWS::CloudFormation::WaitCondition
179+
CreationPolicy:
180+
ResourceSignal:
181+
Timeout: PT15M
182+
Count: 5
183+
```

0 commit comments

Comments
 (0)