SetStackPolicy - AWS CloudFormation

SetStackPolicy

Sets a stack policy for a specified stack.

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

StackName

The name or unique stack ID that you want to associate a policy with.

Type: String

Required: Yes

StackPolicyBody

Structure containing the stack policy body. For more information, see Prevent updates to stack resources in the AWS CloudFormation User Guide. You can specify either the StackPolicyBody or the StackPolicyURL parameter, but not both.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 16384.

Required: No

StackPolicyURL

Location of a file containing the stack policy. The URL must point to a policy (maximum size: 16 KB) located in an Amazon S3 bucket in the same AWS Region as the stack. The location for an Amazon S3 bucket must start with https://. You can specify either the StackPolicyBody or the StackPolicyURL parameter, but not both.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1350.

Required: No

Errors

For information about the errors that are common to all actions, see Common Errors.

Examples

SetStackPolicy

This example illustrates one usage of SetStackPolicy.

Sample Request

https://cloudformation.us-east-1.amazonaws.com/ ?Action=SetStackPolicy &StackName=MyStack &StackPolicyBody=[Stack Policy Document] &Version=2010-05-15 &SignatureVersion=2 &Timestamp=2010-07-27T22%3A26%3A28.000Z &AWSAccessKeyId=[AWS Access KeyID] &Signature=[Signature]

Sample Response

<SetStackPolicyResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/"> <ResponseMetadata> <RequestId>e7d8c346-744b-11e5-b40b-example</RequestId> </ResponseMetadata> </SetStackPolicyResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: