Hi all,
I am trying to deploy to Lambda using `aws-sam-deploy` pipe and got an "Missing option '--image-repository' or '--image-repositories'" error when packaging. However, I have included "image_repositories" inside my `samconfig.toml` file and set SAM_CONFIG to `samconfig.toml` file.
I can build and deploy to AWS Lambda using Docker images from local without any problems with the command `sam build` and then `sam deploy`. So I do not think there's anything wrong with my `template.yaml` or `samconfig.toml`
What steps am I missing? Any help would be greatly appreciated.
Thank you!!
HCL
bitbucket-pipeline error message:
INFO: Using default authentication with AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
INFO: Start package...
SAM CLI now collects telemetry to better understand customer needs.
You can OPT OUT and disable telemetry collection by setting the
environment variable SAM_CLI_TELEMETRY=0 in your shell.
Thanks for your help!
Learn More: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-telemetry.html
Usage: sam package [OPTIONS]
Try 'sam package -h' for help.
Error: Missing option '--image-repository' or '--image-repositories'
✖ Failed SAM package.
Relevant part of my pipeline (monorepo, so I have to cd into the specific directory where `samconfg.toml` and `template.yaml` resides:
script:
- apt-get update
- cd project/function
- pipe: atlassian/aws-sam-deploy:1.2.0
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
S3_BUCKET: 'lambda-function-bucket'
STACK_NAME: 'MyLambdaFunction'
CAPABILITIES: ['CAPABILITY_IAM']
SAM_TEMPLATE: 'template.yaml'
SAM_CONFIG: "samconfig.toml"
WAIT: 'true'
WAIT_INTERVAL: 60
And here's my samconfig.toml:
```
version = 0.1
[default]
[default.deploy]
[default.deploy.parameters]
stack_name = "MyLambdaFunction"
s3_bucket = "lambda-function-bucket"
s3_prefix = "s3-prefix/"
region = "us-east-1"
capabilities = "CAPABILITY_IAM"
image_repositories = ["MyLambdaFunction=12345678910.dkr.ecr.us-east-1.amazonaws.com/my-lambda-function"]
confirm_changeset = false
@Han In our pipe we are using sam package firstly.
image_repositories
parameter is in deploy section, not in package. I guess, it should be in both ones, since the command failed is `sam package`, not sam deploy .
However, if you don't want to use sam package, you can always use deploy command only. Be aware that for deploy that we don't support toml sam config yet.
Regarding aws lambda container image support, we are working on this right now (in aws-lambda-deploy pipe)
Regards, Galyna
Hi @Halyna Berezovska ,
If I understand you correctly, `image_repositories` has to be specified in both `aws-lambda-deploy` pipe and `samconfig.toml`?
I am deploying to Lambda using Docker images manually at the moment. When do you expect `aws-lambda-deploy` to support AWS Lambda container image deployment to be done?
Also, how do I use the deploy command only and what do I need to do to successfully deploy to Lambda from Docker Images?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Han Unfortunately, right now in aws-sam-deploy we don't support images yet.
As a temporary workaround I suggest using sam package with proper config and sam deploy in bitbucket-pipelines without using aws-sam-deploy pipe.
This is to create function.
For update function, basically we use aws-lambda-deploy pipe, but it also does not support images yet.
I suspect you would prefer aws-sam-deploy pipe, where you have samconfig and you would like this samconfig to be support for packaging and deploying.
This is nice improvement and I'll discuss it within the team and notify you with update.
For now I suggest using aws sam cli (we recommend to follow their installation - downloading binary https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-linux.html#serverless-sam-cli-install-linux-sam-cli)
Regards, Galyna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Correct. I would like to have alignment between both manual `sam deploy` and CD via aws-sam-deploy pipe.
AWS just released and AWS SAM Pipelines that generates support for serveless applications, image or otherwise. https://aws.amazon.com/blogs/compute/introducing-aws-sam-pipelines-automatically-generate-deployment-pipelines-for-serverless-applications/. Unfortunately, it only supports Jenkins, GitHub, and GitLab.
When can I expect Bitbucket to reach feature parity with this?
HCL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"I suspect you would prefer aws-sam-deploy pipe, where you have samconfig and you would like this samconfig to be support for packaging and deploying."
This would be an excellent feature. I haven't been able to use the aws-sam-deploy pipe thus far because it's useless to me without accepting a samconfig toml file for the deploy command. Currently I have to use custom images with the AWS SAM CLI installed which are rather large and increase my build time.
If there's an issue link or a roadmap available with this feature on it I'd love a link so I can come back and check periodically to see if this feature has been added.
I wonder how anyone using this pipe is avoiding getting errors without the
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Solved using AWS SAM CLI directly. @Daniel Coppell
FYI, deployment time is highly dependent the size of the docker image, but I find it faster than my local machine probably from higher bandwidth connection to AWS
- step:
name: CD
caches:
- pip
script:
- apt-get update
- pip install awscli
- pip install aws-sam-cli
- aws configure --profile cicd set AWS_ACCESS_KEY_ID ${AWS_ACCESS_KEY_ID}
- aws configure --profile cicd set AWS_SECRET_ACCESS_KEY ${AWS_SECRET_ACCESS_KEY}
- sam build --profile cicd
- sam deploy --profile cicd
services:
- docker
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.