Menu
AWS CloudFormation
API Reference (API Version 2010-05-15)

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, 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.

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 S3 bucket in the same region as the stack. 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.

Example

SetStackPolicy

Sample Request

Copy
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

Copy
<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: