2

I'm writing a function which needs to make some requests to EC2 to create and delete snapshots. However there is currently no feature in Lambda to directly making requests with EC2 resources. I'm attempting to use Class: AWS.TemporaryCredentials but there is a notice that writes:

Note: In order to create temporary credentials, you first need to have "master" credentials configured in AWS.Config.credentials. These master credentials are necessary to retrieve the temporary credentials, as well as refresh the credentials when they expire.

So I'm not sure how to store the credentials since this Lambda is only a function.

1 Answer 1

4

In order for your Lambda function to make EC2 requests, you have to create an IAM role that has the necessary permissions and then associate that role with your IAM function. The AWS Lambda CreateFunction API request has a required parameter called Role which would be the ARN of the new role you have created. In this way, each time your Lambda function is run Lambda will create temporary AWS credentials for it to use that have the permissions defined in the role.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.