如何在python中检索AWS批处理参数值? [英] how to retrieve aws batch parameter value in python?

查看:63
本文介绍了如何在python中检索AWS批处理参数值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

流量:-Dynamo DB-> Lambda->批处理

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

如果将角色arn插入 dynamo DB 中,则从lambda事件中检索它,然后使用 submit_job API将其提交给批处理,并且角色arn作为

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'
}

如何在批量运行的python中读取参数值?

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

推荐答案

首先,您需要在docker文件或类似这样的AWS Batch作业定义命令中指定参数引用

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

在您的Python文件 pythoninbatch.py​​ 中,使用 sys软件包或argparse libray 处理参数变量.

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

sys.argv[1]

这篇关于如何在python中检索AWS批处理参数值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆