< Back
New-PSCFNStack
Post
NAME New-PSCFNStack
SYNOPSIS
Creates a stack.
SYNTAX
New-PSCFNStack [-StackName] <String> [-TemplateLocation] <String> [[-Capabilities] <String>]
[[-ClientRequestToken] <String>] [-Force] [[-DisableRollback] <Boolean>] [[-EnableTerminationProtection]
<Boolean>] [[-NotificationARNs] <String[]>] [[-OnFailure] <OnFailure>] [[-ResourceType] <String[]>] [[-RoleARN]
<String>] [[-RollbackConfiguration_MonitoringTimeInMinute] <Int32>] [[-RollbackConfiguration_RollbackTrigger]
<RollbackTrigger[]>] [[-StackPolicyBody] <String>] [[-StackPolicyURL] <String>] [[-Tag] <Tag[]>]
[[-TimeoutInMinutes] <Int32>] [[-ParameterFile] <String>] [-Wait] [<CommonParameters>]
DESCRIPTION
Creates a stack.
If -Wait is specified, stack events are output to the console including events from any nested stacks.
DYNAMIC PARAMETERS
Once the -TemplateLocation argument has been suppied on the command line
the function reads the template and creates additional command line parameters
for each of the entries found in the "Parameters" section of the template.
These parameters are named as per each parameter in the template and defaults
and validation rules created for them as defined by the template.
Thus, if a template parameter has AllowedPattern and AllowedValues properties,
the resultant function argument will permit TAB completion of the AllowedValues,
assert that you have entered one of these, and for AllowedPattern, the function
argument will assert the regular expression.
Template parameters with no default will become mandatory parameters to this function.
If you do not supply them, you will be prompted for them and the help text for the
parameter will be taken from the Description property of the parameter.
PARAMETERS
-StackName <String>
Name for the new stack.
Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-TemplateLocation <String>
Location of the template.
This may be
- Path to a local file
- s3:// URL pointing to template in a bucket
- https:// URL pointing to template in a bucket
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Capabilities <String>
If the stack requires IAM capabilities, TAB auctocompletes between the capability types.
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ClientRequestToken <String>
A unique identifier for this CreateStack request. Specify this token if you plan to retry requests so that AWS
CloudFormation knows that you're not attempting to create a stack with the same name. You might retry
CreateStack requests to ensure that AWS CloudFormation successfully received them.All events triggered by a
given stack operation are assigned the same client request token, which you can use to track operations. For
example, if you execute a CreateStack operation with the token token1, then all the StackEvents generated by
that operation will have ClientRequestToken set as token1.In the console, stack operations display the client
request token on the Events tab. Stack operations that are initiated from the console use the token format
Console-StackOperation-ID, which helps you easily identify the stack operation . For example, if you create a
stack using the console, each stack event would be assigned the same token in the following format:
Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002.
Required? false
Position? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Force [<SwitchParameter>]
This parameter overrides confirmation prompts to force the cmdlet to continue its operation. This parameter
should always be used with caution.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-DisableRollback <Boolean>
Set to true to disable rollback of the stack if stack creation failed. You can specify either DisableRollback
or OnFailure, but not both.Default: false
Required? false
Position? 5
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-EnableTerminationProtection <Boolean>
Whether to enable termination protection on the specified stack. If a user attempts to delete a stack with
termination protection enabled, the operation fails and the stack remains unchanged. For more information, see
Protecting a Stack From Being Deleted in the AWS CloudFormation User Guide. Termination protection is disabled
on stacks by default. For nested stacks, termination protection is set on the root stack and cannot be changed
directly on the nested stack.
Required? false
Position? 6
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-NotificationARNs <String[]>
The Simple Notification Service (SNS) topic ARNs to publish stack related events. You can find your SNS topic
ARNs using the SNS console or your Command Line Interface (CLI).
Required? false
Position? 7
Default value
Accept pipeline input? false
Accept wildcard characters? false
-OnFailure <OnFailure>
Determines what action will be taken if stack creation fails. This must be one of: DO_NOTHING, ROLLBACK, or
DELETE. You can specify either OnFailure or DisableRollback, but not both.Default: ROLLBACK
Required? false
Position? 8
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ResourceType <String[]>
The template resource types that you have permissions to work with for this create stack action, such as
AWS::EC2::Instance, AWS::EC2::*, or Custom::MyCustomInstance. Use the following syntax to describe template
resource types: AWS::* (for all AWS resource), Custom::* (for all custom resources), Custom::logical_ID (for a
specific custom resource), AWS::service_name::* (for all resources of a particular AWS service), and
AWS::service_name::resource_logical_ID (for a specific AWS resource).If the list of resource types doesn't
include a resource that you're creating, the stack creation fails. By default, AWS CloudFormation grants
permissions to all resource types. AWS Identity and Access Management (IAM) uses this parameter for AWS
CloudFormation-specific condition keys in IAM policies. For more information, see Controlling Access with AWS
Identity and Access Management.
Required? false
Position? 9
Default value
Accept pipeline input? false
Accept wildcard characters? false
-RoleARN <String>
The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that AWS CloudFormation
assumes to create the stack. AWS CloudFormation uses the role's credentials to make calls on your behalf. AWS
CloudFormation always uses this role for all future operations on the stack. As long as users have permission
to operate on the stack, AWS CloudFormation uses this role even if the users don't have permission to pass it.
Ensure that the role grants least privilege.If you don't specify a value, AWS CloudFormation uses the role
that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary
session that is generated from your user credentials.
Required? false
Position? 10
Default value
Accept pipeline input? false
Accept wildcard characters? false
-RollbackConfiguration_MonitoringTimeInMinute <Int32>
The amount of time, in minutes, during which CloudFormation should monitor all the rollback triggers after the
stack creation or update operation deploys all necessary resources.The default is 0 minutes.If you specify a
monitoring period but do not specify any rollback triggers, CloudFormation still waits the specified period of
time before cleaning up old resources after update operations. You can use this monitoring period to perform
any manual stack validation desired, and manually cancel the stack creation or update (using
CancelUpdateStack, for example) as necessary.If you specify 0 for this parameter, CloudFormation still
monitors the specified rollback triggers during stack creation and update operations. Then, for update
operations, it begins disposing of old resources immediately once the operation completes.
Required? false
Position? 11
Default value 0
Accept pipeline input? false
Accept wildcard characters? false
-RollbackConfiguration_RollbackTrigger <RollbackTrigger[]>
The triggers to monitor during stack creation or update actions. By default, AWS CloudFormation saves the
rollback triggers specified for a stack and applies them to any subsequent update operations for the stack,
unless you specify otherwise. If you do specify rollback triggers for this parameter, those triggers replace
any list of triggers previously specified for the stack.
If a specified trigger is missing, the entire stack operation fails and is rolled back.
Required? false
Position? 12
Default value
Accept pipeline input? false
Accept wildcard characters? false
-StackPolicyBody <String>
Structure containing the stack policy body. For more information, go to Prevent Updates to Stack Resources in
the AWS CloudFormation User Guide. You can specify either the StackPolicyBody or the StackPolicyURL parameter,
but not both.
Required? false
Position? 13
Default value
Accept pipeline input? false
Accept wildcard characters? false
-StackPolicyURL <String>
Location of a file containing the stack policy. The URL must point to a policy (maximum size: 16 KB) located
in an S3 bucket in the same region as the stack. You can specify either the StackPolicyBody or the
StackPolicyURL parameter, but not both.
Required? false
Position? 14
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Tag <Tag[]>
Key-value pairs to associate with this stack. AWS CloudFormation also propagates these tags to the resources
created in the stack. A maximum number of 50 tags can be specified.
Required? false
Position? 15
Default value
Accept pipeline input? false
Accept wildcard characters? false
-TimeoutInMinutes <Int32>
The amount of time that can pass before the stack status becomes CREATE_FAILED; if DisableRollback is not set
or is set to false, the stack will be rolled back.
Required? false
Position? 16
Default value 0
Accept pipeline input? false
Accept wildcard characters? false
-ParameterFile <String>
If present, path to a JSON file containing a list of parameter structures as defined for 'aws cloudformation
create-stack'. If a parameter of the same name is defined on the command line, the command line takes
precedence.
If your stack has a parameter with the same name as one of the parameters to this cmdlet, then you *must* set
the stack parameter via a parameter file.
Required? false
Position? 17
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Wait [<SwitchParameter>]
If set, wait for stack creation to complete before returning.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
System.String
You can pipe the new stack name to this function
OUTPUTS
System.String
ARN of the new stack
NOTES
This cmdlet genenerates additional dynamic command line parameters for all parameters found in the Parameters
block of the supplied CloudFormation template
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>New-PSCFNStack -StackName MyStack -TemplateLocation .\\mystack.json -Capabilities CAPABILITY_IAM -Wait
-VpcCidr 10.0.0.0/16
Creates a new stack from a local template file and waits for it to complete.
This template would have 'VpcCidr' defined within its parameter block
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>New-PSCFNStack -StackName MyStack -TemplateLocation
https://s3-eu-west-1.amazonaws.com/mybu ... stack.json -Capabilities CAPABILITY_IAM -Wait -VpcCidr 10.0.0.0/16
As per the first example, but with the template located in S3.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>New-PSCFNStack -StackName MyStack -TemplateLocation s3://mybucket/mystack.json -Capabilities CAPABILITY_IAM
-Wait -VpcCidr 10.0.0.0/16
As per the first example, but using an S3 URL.
Caveat to this mechanism is that you must have a default region set in the curent shell. The bucket is assumed to
be in this region and the stack will also be built in this region.
RELATED LINKS
SYNOPSIS
Creates a stack.
SYNTAX
New-PSCFNStack [-StackName] <String> [-TemplateLocation] <String> [[-Capabilities] <String>]
[[-ClientRequestToken] <String>] [-Force] [[-DisableRollback] <Boolean>] [[-EnableTerminationProtection]
<Boolean>] [[-NotificationARNs] <String[]>] [[-OnFailure] <OnFailure>] [[-ResourceType] <String[]>] [[-RoleARN]
<String>] [[-RollbackConfiguration_MonitoringTimeInMinute] <Int32>] [[-RollbackConfiguration_RollbackTrigger]
<RollbackTrigger[]>] [[-StackPolicyBody] <String>] [[-StackPolicyURL] <String>] [[-Tag] <Tag[]>]
[[-TimeoutInMinutes] <Int32>] [[-ParameterFile] <String>] [-Wait] [<CommonParameters>]
DESCRIPTION
Creates a stack.
If -Wait is specified, stack events are output to the console including events from any nested stacks.
DYNAMIC PARAMETERS
Once the -TemplateLocation argument has been suppied on the command line
the function reads the template and creates additional command line parameters
for each of the entries found in the "Parameters" section of the template.
These parameters are named as per each parameter in the template and defaults
and validation rules created for them as defined by the template.
Thus, if a template parameter has AllowedPattern and AllowedValues properties,
the resultant function argument will permit TAB completion of the AllowedValues,
assert that you have entered one of these, and for AllowedPattern, the function
argument will assert the regular expression.
Template parameters with no default will become mandatory parameters to this function.
If you do not supply them, you will be prompted for them and the help text for the
parameter will be taken from the Description property of the parameter.
PARAMETERS
-StackName <String>
Name for the new stack.
Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-TemplateLocation <String>
Location of the template.
This may be
- Path to a local file
- s3:// URL pointing to template in a bucket
- https:// URL pointing to template in a bucket
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Capabilities <String>
If the stack requires IAM capabilities, TAB auctocompletes between the capability types.
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ClientRequestToken <String>
A unique identifier for this CreateStack request. Specify this token if you plan to retry requests so that AWS
CloudFormation knows that you're not attempting to create a stack with the same name. You might retry
CreateStack requests to ensure that AWS CloudFormation successfully received them.All events triggered by a
given stack operation are assigned the same client request token, which you can use to track operations. For
example, if you execute a CreateStack operation with the token token1, then all the StackEvents generated by
that operation will have ClientRequestToken set as token1.In the console, stack operations display the client
request token on the Events tab. Stack operations that are initiated from the console use the token format
Console-StackOperation-ID, which helps you easily identify the stack operation . For example, if you create a
stack using the console, each stack event would be assigned the same token in the following format:
Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002.
Required? false
Position? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Force [<SwitchParameter>]
This parameter overrides confirmation prompts to force the cmdlet to continue its operation. This parameter
should always be used with caution.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-DisableRollback <Boolean>
Set to true to disable rollback of the stack if stack creation failed. You can specify either DisableRollback
or OnFailure, but not both.Default: false
Required? false
Position? 5
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-EnableTerminationProtection <Boolean>
Whether to enable termination protection on the specified stack. If a user attempts to delete a stack with
termination protection enabled, the operation fails and the stack remains unchanged. For more information, see
Protecting a Stack From Being Deleted in the AWS CloudFormation User Guide. Termination protection is disabled
on stacks by default. For nested stacks, termination protection is set on the root stack and cannot be changed
directly on the nested stack.
Required? false
Position? 6
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-NotificationARNs <String[]>
The Simple Notification Service (SNS) topic ARNs to publish stack related events. You can find your SNS topic
ARNs using the SNS console or your Command Line Interface (CLI).
Required? false
Position? 7
Default value
Accept pipeline input? false
Accept wildcard characters? false
-OnFailure <OnFailure>
Determines what action will be taken if stack creation fails. This must be one of: DO_NOTHING, ROLLBACK, or
DELETE. You can specify either OnFailure or DisableRollback, but not both.Default: ROLLBACK
Required? false
Position? 8
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ResourceType <String[]>
The template resource types that you have permissions to work with for this create stack action, such as
AWS::EC2::Instance, AWS::EC2::*, or Custom::MyCustomInstance. Use the following syntax to describe template
resource types: AWS::* (for all AWS resource), Custom::* (for all custom resources), Custom::logical_ID (for a
specific custom resource), AWS::service_name::* (for all resources of a particular AWS service), and
AWS::service_name::resource_logical_ID (for a specific AWS resource).If the list of resource types doesn't
include a resource that you're creating, the stack creation fails. By default, AWS CloudFormation grants
permissions to all resource types. AWS Identity and Access Management (IAM) uses this parameter for AWS
CloudFormation-specific condition keys in IAM policies. For more information, see Controlling Access with AWS
Identity and Access Management.
Required? false
Position? 9
Default value
Accept pipeline input? false
Accept wildcard characters? false
-RoleARN <String>
The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that AWS CloudFormation
assumes to create the stack. AWS CloudFormation uses the role's credentials to make calls on your behalf. AWS
CloudFormation always uses this role for all future operations on the stack. As long as users have permission
to operate on the stack, AWS CloudFormation uses this role even if the users don't have permission to pass it.
Ensure that the role grants least privilege.If you don't specify a value, AWS CloudFormation uses the role
that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary
session that is generated from your user credentials.
Required? false
Position? 10
Default value
Accept pipeline input? false
Accept wildcard characters? false
-RollbackConfiguration_MonitoringTimeInMinute <Int32>
The amount of time, in minutes, during which CloudFormation should monitor all the rollback triggers after the
stack creation or update operation deploys all necessary resources.The default is 0 minutes.If you specify a
monitoring period but do not specify any rollback triggers, CloudFormation still waits the specified period of
time before cleaning up old resources after update operations. You can use this monitoring period to perform
any manual stack validation desired, and manually cancel the stack creation or update (using
CancelUpdateStack, for example) as necessary.If you specify 0 for this parameter, CloudFormation still
monitors the specified rollback triggers during stack creation and update operations. Then, for update
operations, it begins disposing of old resources immediately once the operation completes.
Required? false
Position? 11
Default value 0
Accept pipeline input? false
Accept wildcard characters? false
-RollbackConfiguration_RollbackTrigger <RollbackTrigger[]>
The triggers to monitor during stack creation or update actions. By default, AWS CloudFormation saves the
rollback triggers specified for a stack and applies them to any subsequent update operations for the stack,
unless you specify otherwise. If you do specify rollback triggers for this parameter, those triggers replace
any list of triggers previously specified for the stack.
If a specified trigger is missing, the entire stack operation fails and is rolled back.
Required? false
Position? 12
Default value
Accept pipeline input? false
Accept wildcard characters? false
-StackPolicyBody <String>
Structure containing the stack policy body. For more information, go to Prevent Updates to Stack Resources in
the AWS CloudFormation User Guide. You can specify either the StackPolicyBody or the StackPolicyURL parameter,
but not both.
Required? false
Position? 13
Default value
Accept pipeline input? false
Accept wildcard characters? false
-StackPolicyURL <String>
Location of a file containing the stack policy. The URL must point to a policy (maximum size: 16 KB) located
in an S3 bucket in the same region as the stack. You can specify either the StackPolicyBody or the
StackPolicyURL parameter, but not both.
Required? false
Position? 14
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Tag <Tag[]>
Key-value pairs to associate with this stack. AWS CloudFormation also propagates these tags to the resources
created in the stack. A maximum number of 50 tags can be specified.
Required? false
Position? 15
Default value
Accept pipeline input? false
Accept wildcard characters? false
-TimeoutInMinutes <Int32>
The amount of time that can pass before the stack status becomes CREATE_FAILED; if DisableRollback is not set
or is set to false, the stack will be rolled back.
Required? false
Position? 16
Default value 0
Accept pipeline input? false
Accept wildcard characters? false
-ParameterFile <String>
If present, path to a JSON file containing a list of parameter structures as defined for 'aws cloudformation
create-stack'. If a parameter of the same name is defined on the command line, the command line takes
precedence.
If your stack has a parameter with the same name as one of the parameters to this cmdlet, then you *must* set
the stack parameter via a parameter file.
Required? false
Position? 17
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Wait [<SwitchParameter>]
If set, wait for stack creation to complete before returning.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
System.String
You can pipe the new stack name to this function
OUTPUTS
System.String
ARN of the new stack
NOTES
This cmdlet genenerates additional dynamic command line parameters for all parameters found in the Parameters
block of the supplied CloudFormation template
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>New-PSCFNStack -StackName MyStack -TemplateLocation .\\mystack.json -Capabilities CAPABILITY_IAM -Wait
-VpcCidr 10.0.0.0/16
Creates a new stack from a local template file and waits for it to complete.
This template would have 'VpcCidr' defined within its parameter block
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>New-PSCFNStack -StackName MyStack -TemplateLocation
https://s3-eu-west-1.amazonaws.com/mybu ... stack.json -Capabilities CAPABILITY_IAM -Wait -VpcCidr 10.0.0.0/16
As per the first example, but with the template located in S3.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>New-PSCFNStack -StackName MyStack -TemplateLocation s3://mybucket/mystack.json -Capabilities CAPABILITY_IAM
-Wait -VpcCidr 10.0.0.0/16
As per the first example, but using an S3 URL.
Caveat to this mechanism is that you must have a default region set in the curent shell. The bucket is assumed to
be in this region and the stack will also be built in this region.
RELATED LINKS