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

GetStackPolicy

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.

StackName

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

Type: String

Required: Yes

Response Elements

The following element is returned by the service.

StackPolicyBody

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

Type: String

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

Errors

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

Example

GetStackPolicy

Sample Request

https://cloudformation.us-east-1.amazonaws.com/ ?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="http://cloudformation.amazonaws.com/doc/2010-05-15/"> <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 AWS SDKs, see the following: