Sanat Favas
Sanat Favas

Reputation: 1

Running a python script on AWS which is executable by a single IAM user only

I have a python script whose boto3 operations/function calls must be restricted to a single IAM user which has extremely limited access. My understanding is that the execution of the script depends on the configured profile for AWS CLI. Would that sort of restriction have to done inside the script?

Upvotes: 0

Views: 161

Answers (1)

Bert Blommers
Bert Blommers

Reputation: 2123

The script could be created as a AWS Lambda function. Only the single IAM user should then be given access to execute that function.

Another script can be written to invoke that Lambda (boto3.client("lambda").invoke()). Anyone can execute that script, but anyone but the right user will get an AccessPermissions error.

Note:

  • There are limitations on the execution time/memory allocation for AWS lambdas, which might make this a bad solution for your current script. That really depends on what your script exactly does.

Upvotes: 2

Related Questions