AWS CloudFormation
User Guide (API Version 2010-05-15)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

cfn-create-stack

Description

Create a new stack from a template stored in a local file or in an Amazon S3 bucket. If any resource defined in the template cannot be created, the stack will be rolled back, deleting all resources created up to that point. This behavior can be disabled by using the --disable-rollback option.

Syntax

cfn-create-stack StackName common-options cfn-create-stack-options

The cfn-create-stack-options that you can specify are described in the Options section of this topic.

Options

NameDescriptionRequired

StackName

Name of the Stack. A stack name must contain only alphanumeric characters and must start with an alphabetic character. The maximum length of the name is 255 characters. Stack names are case sensitive. You can also set this value using --stack-name.

Type: String

Default: None

Example: websrv

Yes

-d, --disable-rollback

Flag to disable rollback of created resources when failures are encountered during stack creation. The default value is false.

Type: String

Default: None

No

--template-file VALUE

Path to the file that contains the template. An uploaded template can be, at most, 51200 bytes.

Type: String

Default: None

No

-n, --notification-arns VALUE1, VALUE2, VALUE3...

SNS ARNs to receive notification about the stack.

Type: String

Default: None

No

-p, --parameters "key1=value1; key2=value2 ..."

Parameter values used to create the stack.

Type: String

Default: None

No

-t, --timeout VALUE

Stack creation timeout in minutes.

Type: String

Default: None

No

--tag "Key=value; Value=value"

A set of user-defined Tags to associate with this stack, represented by key/value pairs. This option can be repeated to specify a number of such pairs.

Type: String

Example: --tag "Key=Purpose; Value=Testing" --tag "Key=endpoint; Value=us-east-1"

No

-u, --template-url VALUE

Path of the URL that contains the template. The URL must point to a template (max size: 307,200 bytes) in an Amazon S3 bucket that you have read permissions to, located in the same region as the stack. The URL itself can be, at most, 1024 characters long.

Type: String

Default: None

No

-c, --capabilities VALUE

The list of capabilities that you want to allow in the stack. If your template contains IAM resources, you must specify the CAPABILITY_IAM value for this parameter; otherwise, this action returns an InsufficientCapabilities error. IAM resources are the following: AWS::IAM::AccessKey, AWS::IAM::Group, AWS::IAM::Policy, AWS::IAM::UserToGroupAddition, and AWS::IAM::User. For more information about using IAM resources in templates, see Controlling User Access with AWS Identity and Access Management.

Type: String

Valid Values: CAPABILITY_IAM

Default: None

No

Output

This command returns a table that contains the following:

  • STACK_ID

    Unique Identifier for the Stack

AWS CloudFormation displays errors on stderr.

Examples

Example Request

Create a Stack named example-stack using template located in file example-template-file and specifying template parameters param1 and param2.

> cfn-create-stack example-stack --template-file example-template-file --parameters "param1=foo;param2=bar"

arn:aws:aws21:us-east-1:123456789:stack/aaf549a0-a413-11df-adb3-5081b3858e83/example-stack