问题
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 pythonawscli
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