Search code examples
amazon-web-servicesamazon-s3aws-lambdaserverlessaws-config

How do I reference a AWS Service-Only User config within a Lambda (separate from the User/config I used to deploy the Lambda)?


So I have one IAM Profile/User that I am using to deploy a Lambda function, but this Lambda function needs to instantiate a new AWS Session to connect to a whitelisted S3 bucket. Each of these users have distinct Keys, Secrets, and coordinated policies that are set up for their distinct purposes.

I cannot set the profile in my serverless.yaml to the S3 configuration, as I won't have adequate permissions to deploy the Lambda. How can I in-code reference a distinct aws.Config{}? Ideally, I do not want to statically store the keys/secret for the S3 configured IAM in Parameter Store but that's all I can think as of now.


Solution

  • I ended up using Secrets Manager to store the Access Key and Secret Access Key for my user ARN. When initiating my AWS Session, I would pull the credentials from AWS Secret Manager and use the static credentials configuration option. It is not an ideal implementation but it worked.