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
9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 | |