CmdID / aws / aws secretsmanager
aws secretsmanager get-resource-policy
Retrieves the JSON text of the resource-based policy document attached to the secret. AWS CLI reference
1 example 1 option Its page in the AWS CLI reference
Examples
To retrieve the resource-based policy attached to a secret
The following get-resource-policy example retrieves the resource-based policy attached to a secret.
aws secretsmanager get-resource-policy --secret-id MyTestSecretIdentify--secret-idThe ARN or name of the secret to retrieve the attached resource-based policy for.Its output
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestSecret-a1b2c3",
"Name": "MyTestSecret",
"ResourcePolicy": "{\n\"Version\":\"2012-10-17\",\n\"Statement\":[{\n\"Effect\":\"Allow\",\n\"Principal\":{\n\"AWS\":\"arn:aws:iam::123456789012:root\"\n},\n\"Action\":\"secretsmanager:GetSecretValue\",\n\"Resource\":\"*\"\n}]\n}"
}For more information, see Authentication and access control in the Secrets Manager User Guide.
Options
--secret-idThe ARN or name of the secret to retrieve the attached resource-based policy for.