How to run `AWS CLI` command within `aws lambda` function?

百般思念 提交于 2019-12-11 05:29:30

问题


I would like to run aws cli command (actually aws s3 sync) from within the aws lambda function. How do I do that? Ideally in python, but javascript (or java) would work too.

Using python I tried achieving this by Creating a Deployment Package where i would have awscli as a python package, so that I can use it later. However, the aws command is not available during lambda function execution, and only the awscli package is.

How can I:

  • either: make sure that I have awscli available to be called during lambda function execution?
  • or: construct a aws s3 sync call directly from python awscli library?

回答1:


Look the project https://github.com/lucioveloso/cli2cloudformation and you will figure out how to wrapper the cli inside a lambda function.



来源:https://stackoverflow.com/questions/37382837/how-to-run-aws-cli-command-within-aws-lambda-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!