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
9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 | |