put_resource_policy
async
¶
put_resource_policy(
resource_arn: ResourceArnString,
policy: Policy,
*,
config_overrides: Optional[AsyncSSMClientConfig] = 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/async_ssm.py
9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 | |