8

I want to get started with AWS SAM and I encounter this issue when trying to deploy to the AWS.

I am trying to deploy a 'Hello World!'-application that can be found here.

This is the error I encounter:

$ sam package --s3-bucket dolphin-code --s3-prefix prod --output-template-file packaged.yaml --region eu-central-1

Uploading to prod/de65208b144ad296cfdc39666a47ad1c 34671 / 34671.0 (100.00%) Successfully packaged artifacts and wrote output template to file packaged.yaml. Execute the following command to deploy the packaged template sam deploy --template-file /builds/gitlab/dophin/apis/hello-world/packaged.yaml --stack-name

$ sam deploy --template-file ./packaged.yaml --stack-name prod --capabilities CAPABILITY_IAM --region eu-central-1

Deploying with following values =============================== Stack name : prod Region : eu-central-1 Confirm changeset : False Deployment s3 bucket : None Capabilities : ["CAPABILITY_IAM"] Parameter overrides : {} Initiating deployment ===================== Error: Failed to create changeset for the stack: prod, An error occurred (ValidationError) when calling the CreateChangeSet operation: Parameters: [IdentityNameParameter] must have values ERROR: Job failed: exit code 1

For me, that seems to be an error in the AWS CLI and not in SAM directly, right?

Can anyone help me? Thanks in advance!

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
ledex
  • 97
  • 1
  • 1
  • 7

1 Answers1

13

It seems that you are using a parameter in your sam template called "IdentityNameParameter", and it doesn't have a default value, thus Sam expects you to provide a value for it.

Either you set the value when you call your sam deploy using the flag --parameters-overrides

$ sam deploy --template-file ./packaged.yaml --stack-name prod --capabilities CAPABILITY_IAM --region eu-central-1 --parameter-overrides IdentityNameParameter=xyz

or give it a default value in your SAM template

Parameters: 
    IdentityNameParameter: 
      Type: String
      Default:"xyz"

You can read more about the sam deploy command here https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-deploy.html

me2resh
  • 786
  • 6
  • 10