3

Flow :- Dynamo DB --> Lambda --> Batch

If a role arn is inserted in dynamo DB, it is retrieved from lambda event, it is then submitted to batch using submit_job API with role arn being passed as

parameters={
    'role_arn': 'arn:aws:iam::accountid:role/role_name'
}

How to read the parameter value in python running in batch?

1 Answer 1

8

First you need to specify the parameter reference in your docker file or in AWS Batch job definition command like this

/usr/bin/python/pythoninbatch.py Ref::role_arn

In your Python file pythoninbatch.py handle the argument variable using sys package or argparse libray.

sys.argv[1]
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, it worked, I tried adding the argument in job definition and used sys package to retrieve the role_arn.
Finally, someone makes this very clear. This was not at all obvious to me from the AWS Batch documentation. Thank you!

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.