GetStackPolicy - Amazon CloudFormation
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).


Returns the stack policy for a specified stack. If a stack doesn't have a policy, a null value is returned.

Request Parameters

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


The name or unique stack ID that's associated with the stack whose policy you want to get.

Type: String

Required: Yes

Response Elements

The following element is returned by the service.


Structure containing the stack policy body. (For more information, go to Prevent Updates to Stack Resources in the Amazon CloudFormation User Guide.)

Type: String

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


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



This example illustrates one usage of GetStackPolicy.

Sample Request ?Action=GetStackPolicy &StackName=MyStack &Version=2010-05-15 &SignatureVersion=2 &Timestamp=2010-07-27T22%3A26%3A28.000Z &AWSAccessKeyId=[AWS Access KeyID] &Signature=[Signature]

Sample Response

<GetStackPolicyResponse xmlns=""> <GetStackPolicyResult> <StackPolicyBody>"{ "Statement" : [ { "Effect" : "Deny", "Action" : "Update:*", "Principal" : "*", "Resource" : "LogicalResourceId/ProductionDatabase" }, { "Effect" : "Allow", "Action" : "Update:*", "Principal" : "*", "Resource" : "*" } ] }</StackPolicyBody> </GetStackPolicyResult> <ResponseMetadata> <RequestId>b9b4b068-3a41-11e5-94eb-example</RequestId> </ResponseMetadata> </GetStackPolicyResponse>

See Also

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