![](/img/trans.png)
[英]How can I connect to snowflake in aws lambda function without using snowflake-connector-python?
[英]How can I create an python AWS Lambda function using the AWS CLI?
如何在Python中創建簡單的Lambda函數
這似乎是NodeJS的示例,但正在尋找Python版本。
aws lambda create-function --function-name helloworld \
--zip-file fileb://function.zip --handler index.handler --runtime nodejs8.10 \
--role arn:aws:iam::123456789012:role/lambda-cli-role
{
"FunctionName": "helloworld",
"CodeSize": 351,
"MemorySize": 128,
"FunctionArn": "function-arn",
"Handler": "index.handler",
"Role": "arn:aws:iam::account-id:role/LambdaExecRole",
"Timeout": 3,
"LastModified": "2015-04-07T22:02:58.854+0000",
"Runtime": "nodejs8.10",
"Description": ""
}
您可以使用相同的CLI選項,但可以指定python運行時以及以zip文件格式包含python應用程序。
aws lambda create-function --function-name helloworld \
--zip-file fileb://test.zip \
--handler lambda_function.lambda_handler \
--runtime python3.7 \
--role arn:aws:iam::XXXX:role/CustomLambdaRoleARN
CLI Output:
{
"FunctionName": "helloworld",
"FunctionArn": "arn:aws:lambda:us-west-2:XXXXXX:function:helloworld",
"Runtime": "python3.7",
"Role": "arn:aws:iam::XXXX:role/CustomLambdaRoleARN",
"Handler": "lambda_function.lambda_handler",
"CodeSize": 236,
"Description": "",
"Timeout": 3,
"MemorySize": 128,
"LastModified": "2019-04-23T04:25:33.052+0000",
"CodeSha256": "5Gm3xdLGxELEIboaATKL7pr4sxrjNV1kuT9l9kpFG0g=",
"Version": "$LATEST",
"TracingConfig": {
"Mode": "PassThrough"
},
"RevisionId": "3f18add5-d347-4754-83e5-61dfdeabda9a"
如果您在構建Lambda應用程序zip文件時需要幫助,請參閱此演練。 https://geektopia.tech/post.php?blogpost=Create_Lambda_Package_Python
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.