[英]AWS SAM Lambda - Unable to import module 'main': No module named 'requests', 'msal' . pipeline using Azure CI/CD
[英]how to build, package and deploy AWS SAM lambda function of python from azure Devops CI/CD pipeline to AWS
我使用 aws sam lambda function(hello_world) 模板创建了一个项目。 我可以使用 sam 命令在本地构建、调用和从本地部署。 现在,代码在 Azure 仓库中。 我使用“python 包”进行管道和部署,但我不知道如何构建 package 和部署 sam cmd 的脚本? 我搜索谷歌但没有得到好的资源或视频。
请给我一些好的资源,视频等。
以下脚本完美运行。 它可能会帮助某人。
- task: AWSShellScript@1
displayName: 'Build'
inputs:
awsCredentials: AwsServiceConnection
regionName: $(Region)
scriptType: 'inline'
inlineScript: |
sam build --debug \
--template-file template.yaml
- task: AWSShellScript@1
displayName: 'Package'
inputs:
awsCredentials: AwsServiceConnection
regionName: $(Region)
scriptType: 'inline'
inlineScript: |
sam package --resolve-s3 (or it can be a bucket name. --s3-bucket <bucketname>) --output-template-file packaged.yaml
- task: AWSShellScript@1
displayName: 'Deploy Infrastructure'
inputs:
awsCredentials: AwsServiceConnection
regionName: $(Region)
scriptType: "inline"
inlineScript: |
sam deploy \
--template-file packaged.yaml \
--no-confirm-changeset \
--no-fail-on-empty-changeset \
--capabilities CAPABILITY_IAM \
--stack-name test-dev-stack \
--resolve-s3 \ ( or it can be a bucket name. --s3-bucket <bucketname>)
--s3-prefix test-dev-stack
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.