Skip to content

CloudFormation  >  Operations  >  set_stack_policy

set_stack_policy

Operation

set_stack_policy async

set_stack_policy(input: SetStackPolicyInput, plugins: list[Plugin] | None = None) -> SetStackPolicyOutput

Sets a stack policy for a specified stack.

Parameters:

Name Type Description Default
input SetStackPolicyInput

An instance of SetStackPolicyInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
SetStackPolicyOutput

An instance of SetStackPolicyOutput.

Input

SetStackPolicyInput dataclass

Bases: _SerdeShape

The input for the SetStackPolicy action.

Attributes

stack_name class-attribute instance-attribute
stack_name: str | None = ...

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

stack_policy_body class-attribute instance-attribute
stack_policy_body: str | None = ...

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

stack_policy_url class-attribute instance-attribute
stack_policy_url: str | None = ...

Location of a file that contains the stack policy. The URL must point to a policy (maximum size: 16 KB) located in an Amazon S3 bucket in the same Amazon Web Services Region as the stack. The location for an Amazon S3 bucket must start with https://. URLs from S3 static websites are not supported.

You can specify either the StackPolicyBody or the StackPolicyURL parameter, but not both.

Output

SetStackPolicyOutput dataclass

Bases: _SerdeShape

Dataclass for SetStackPolicyOutput structure.

Attributes

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.