0

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?

1
  • You could probably verify boto3 session for that particular IAM user? Commented Nov 26, 2021 at 7:27

1 Answer 1

2

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.
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.