Aws sam serverless application model

i am trying to integrate gitlab ci/cd with aws SAM.

gitlab and aws examples for SAM show python examples and state

The image with Python 3.8 is used in this example since the sample application is written in Python 3.8.

given this phrasing, one would assume that for a node app, one would use a node image, as shown in the gitlab-ci.yml file below. i tried to invoke sam directly but it does not seem like this docker image has sam installed. is there a default method for invoking sam from ci/cd or will i have to import a binary or is there another solution?

image: node:12.1

stages: 
  - deploy

production:
  stage: deploy
  script:
    - sam build
    - sam package --output-template-file packaged.yaml --s3-bucket test-sam
    - sam deploy --template-file packaged.yaml --stack-name sam-gitlab-ci --s3-bucket test-sam --capabilities CAPABILITY_IAM --region us-east-1
  • What version are you on? Are you using self-managed or GitLab.com?

i found some great resources that answer my question.

this webcast provides a good overview of using sam with gitlab-ci and node: https://learn.gitlab.com/c/deploy-aws-lambda-ap?x=04KSqy

it references a presenter’s github repo which contains a working demo

1 Like

As of recently this can be solved using the AWS NodeJS images https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-image-repositories.html so you don’t have to create your own Docker image. It worked for my NodeJS app (used Node18, I see there might be some issues with the image for Node 20).