How to access secrets from Secrets manager cross account by friendlyName and NOT the secretARN?
Scenario:
- CMK KMS in AccountA - Key Policy attached for AccountB
- Secrets stored in AccountA - Resource policy added to AccountB
- EC2 in AccountB with IAM role(secret and cmk kms) attached
Observation: get secret details by calling --secret-id (ARN) of secrets works fine and I get the desired output
Issue:
aws secretsmanager get-secret-value --secret-id (friendlyName) --region region
get secret details by calling --secret-id (friendlyName) of secrets gets failed with error
An error occurred (AccessDeniedException) when calling the GetSecretValue operation: User: arn:aws:sts::111111111:assumed-role/xxxx-xxxx-Role/i-xxxxx is not authorized to perform: secretsmanager:GetSecretValue on resource: (friendlyName)