Home > front end >  AWS CloudFormation package does not upload local Lambda files to S3
AWS CloudFormation package does not upload local Lambda files to S3

Time:10-15

I am trying to upload local artifacts that are referenced in CF template to an S3 bucket using aws cloudformation package command and then deploy the packaged one to S3. Then, when I run the command:

aws cloudformation package --template-file template-file.yaml --s3-bucket my-app-cf-s3-bucket

It creates the packaged YAML file but does not upload anything to my S3 bucket.

Here is my CloudFormation

Resources:
  MyUserPoolPreSignupLambda:
    type: AWS::Lambda::Function
    Properties:
      FunctionName: MyUserPoolPreSignup
      Code: lambda-pre-signup.js
      Runtime: nodejs-16

What am I doing wrong here?

CodePudding user response:

  1. Check if you provided IAM user credentials for the AWS CLI (credentials file / Env variables)

  2. If the template has no change, CLI won't upload files for multiple calls. To upload forcefully even if there is no change in your template, use '--force upload'

    --force-upload (boolean) Indicates whether to override existing files in the S3 bucket. Specify this flag to upload artifacts even if they match existing artifacts in the S3 bucket.

CodePudding user response:

I had a typo in my cloudformation template. The type property must be capitalized:

type: AWS::Lambda::Function instead of Type: AWS::Lambda::Function

  • Related