put_resource_policy
¶
put_resource_policy(
resource_arn: ResourceArnString,
policy: Policy,
*,
config_overrides: Optional[SSMClientConfig] = None,
policy_id: Optional[PolicyId] = None,
policy_hash: Optional[PolicyHash] = None,
) -> PutResourcePolicyResponse
Creates or updates a Systems Manager resource policy. A resource policy helps you to define the IAM entity (for example, an Amazon Web Services account) that can manage your Systems Manager resources. The following resources support Systems Manager resource policies.
-
OpsItemGroup- The resource policy forOpsItemGroupenables Amazon Web Services accounts to view and interact with OpsCenter operational work items (OpsItems). -
Parameter- The resource policy is used to share a parameter with other accounts using Resource Access Manager (RAM).To share a parameter, it must be in the advanced parameter tier. For information about parameter tiers, see Managing parameter tiers. For information about changing an existing standard parameter to an advanced parameter, see Changing a standard parameter to an advanced parameter.
To share a
SecureStringparameter, it must be encrypted with a customer managed key, and you must share the key separately through Key Management Service. Amazon Web Services managed keys cannot be shared. Parameters encrypted with the default Amazon Web Services managed key can be updated to use a customer managed key instead. For KMS key definitions, see KMS concepts in the Key Management Service Developer Guide.While you can share a parameter using the Systems Manager
PutResourcePolicyoperation, we recommend using Resource Access Manager (RAM) instead. This is because usingPutResourcePolicyrequires the extra step of promoting the parameter to a standard RAM Resource Share using the RAM PromoteResourceShareCreatedFromPolicy API operation. Otherwise, the parameter won't be returned by the Systems Manager DescribeParameters API operation using the--sharedoption.For more information, see Sharing a parameter in the Amazon Web Services Systems Manager User Guide
-
Document– Shares the document using Resource Access Manager (RAM). For more information about sharing documents, see Sharing Systems Manager documents in the Amazon Web Services Systems Manager User Guide.
While you can share a document using the Systems Manager PutResourcePolicy operation, we recommend using Resource Access Manager (RAM) instead. Using PutResourcePolicy requires an extra step. You must promote the document to a standard RAM Resource Share using the RAM PromoteResourceShareCreatedFromPolicy API operation. Otherwise, the Systems Manager ListDocuments API operation won't return the document when filtering for shared documents. The Amazon Web Services Config PutRemediationConfigurations API operation also can't use the document.
Parameters:
-
resource_arn(ResourceArnString) –Amazon Resource Name (ARN) of the resource to which you want to attach a policy.
-
policy(Policy) –A policy you want to associate with a resource.
-
policy_id(Optional[PolicyId], default:None) –The policy ID.
-
policy_hash(Optional[PolicyHash], default:None) –ID of the current policy version. The hash helps to prevent a situation where multiple users attempt to overwrite a policy. You must provide this hash when updating or deleting a policy.
Raises:
-
InternalServerError–An error occurred on the server side.
-
MalformedResourcePolicyDocumentException–The specified policy document is malformed or invalid, or excessive
PutResourcePolicyorDeleteResourcePolicycalls have been made. -
ResourceNotFoundException–The specified parameter to be shared could not be found.
-
ResourcePolicyConflictException–The hash provided in the call doesn't match the stored hash. This exception is thrown when trying to update an obsolete policy version or when multiple requests to update a policy are sent.
-
ResourcePolicyInvalidParameterException–One or more parameters specified for the call aren't valid. Verify the parameters and their values and try again.
-
ResourcePolicyLimitExceededException–The PutResourcePolicy API action enforces two limits. A policy can't be greater than 1024 bytes in size. And only one policy can be attached to
OpsItemGroup. Verify these limits and try again. -
ResourcePolicyNotFoundException–No policies with the specified policy ID and hash could be found.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_ssm/_services/ssm.py
9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 | |