This is not a duplicate. I have searched and could not find an exact match for this.
I have Python code running on my local machine.
I want to connect to AWS for the purpose of pulling a secret from AWS Secrets Management
On my local machine $HOME/.aws/config file, I have a profile configured.
[profile my-profile]
...
The profile is setup with the region, AWS account ID etc.
This is a known working profile that will connect to AWS.
I have configured an AWS IAM Role that is configured to restrict access to a secret stored in AWS Secrets.
On my local machine, in python code, I want to create a boto3 session and client that will:
- use the AWS local profile settings to connect to AWS
- and connect assuming the IAM role
so I can then pull the secret.
How do I create this boto3 session / client with this criteria?
I am not finding documentation on how to use both (local AWS profile by name and also assume AWS IAM role) for the specific purpose of pulling from AWS Secrets Management.
If anyone has actually done this, it would be greatly appreciated if code could be shared.
I have pulling a secret not assuming the role working fine on pulling a secret that is not restricted by a role.
Now I have created another secret restricted by a role and I cannot get this to work.