英文:
How to use AWS code artifact using serverless framework
问题
我想使用以下命令将我的无服务器包上传到AWS Code Artifact:
sls package --package target/dev --verbose --stage dev
aws codeartifact login --tool twine --repository XX --domain XX --domain-owner XX --region XX
twine upload --repository codeartifact target/dev/*
但我遇到以下错误:
ERROR InvalidDistribution: Unknown distribution format: 'cloudformation-template-create-stack.json'
是否可以将无服务器包上传到AWS Code Artifact,还是我漏掉了什么?
在使用Pypi时可能会遇到相同的问题
谢谢
英文:
I want to upload my serverless package in AWS Code Artifact using :
sls package --package target/dev --verbose --stage dev
aws codeartifact login --tool twine --repository XX --domain XX --domain-owner XX --region XX
twine upload --repository codeartifact target/dev/*
But I am getting the following error:
ERROR InvalidDistribution: Unknown distribution format: 'cloudformation-template-create-stack.json'
Is it possible to upload a serverless package to AWS Code Artifact or Am I missing something?
It should be the same problem using Pypi
Thanks
答案1
得分: 1
CodeArtifact 旨在创建托管的工件存储库服务:
> 您可以将 CodeArtifact 与流行的构建工具和包管理器一起使用,如 NuGet CLI、Maven、Gradle、npm、yarn、pip 和 twine。
考虑到这一点,sls package
不会为这些构建工具和包管理器创建有效的包格式。
Serverless Framework CLI 为 AWS 生成部署工件。这些工件将上传到 Amazon S3 存储桶,并通过 AWS CloudFormation 进行部署时会引用这些工件。
您描述的用例不是 CodeArtifact 的“正确”用法。
如果您愿意,可以让它运行。运行 sls package
并修改输出文件夹以创建有效的 twine/pypi 包:https://www.geeksforgeeks.org/how-to-publish-python-package-at-pypi-using-twine-module/,但这不是 sls
CLI 的设计目的。
英文:
CodeArtifact aims to create managed artifact repository service:
> You can use CodeArtifact with popular build tools and package managers such as the NuGet CLI, Maven, Gradle, npm, yarn, pip, and twine.
With that in mind, sls package
doesn't not create a valid package format for any of these build tools and pacakge managers.
The Serverless Framework CLI generates deployment artifacts for AWS. These artifacts are uploaded to an Amazon S3 bucket, and the deployment via AWS CloudFormation will reference these artifacts.
The use case you described is not the "correct" one for CodeArtifact.
If you want, you can make it work. Run sls package
and modify the output folder to be a valid twine/pypi package: https://www.geeksforgeeks.org/how-to-publish-python-package-at-pypi-using-twine-module/, but that is not what sls
CLI was built for.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论