I am using Node with lambda and the AWS Javascript SDK. I have a role attached to the lambda function that allows the access I need to do. I want to be able to accept user input of access and secret keys and update my AWS config to perform new actions with those updated credentials. So far
let AWS = require("aws-sdk"); // I do the normal import
let ddb = new AWS.DynamoDB({apiVersion: '2012-10-08'}); // do some dynamo action
....
Then use these keys that have rights to another accounts resources
AWS.config = new AWS.Config({
accessKeyId: data.accessKey,
secretAccessKey: data.secretAccessKey
});
When I perform a new task it just uses the permissions provided with the lambda role and not the updated AWS creds. Any ideas?