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
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.