2

Using aws-sam-cli==0.48.0 I am trying to upload a lambda inside an existing folder of an AWS S3 bucket. The path is "my-modelling/lambdas"

When I execute this command on a MacOS command line:

sam package --template-file template.yaml --output-template-file deploy --s3-bucket my-modelling/lambdas

I get:

Error: Unable to upload artifact module/ referenced by CodeUri parameter of MyFunction resource.
Parameter validation failed:
Invalid bucket name "my-modelling/lambdas": Bucket name must match the regex "^[a-zA-Z0-9.\-_]{1,255}$" or be an ARN matching the regex "^arn:(aws).*:s3:[a-z\-0-9]+:[0-9]{12}:accesspoint[/:][a-zA-Z0-9\-]{1,63}$"

Note that this works fine if I only specify the bucket name:

sam package --template-file template.yaml --output-template-file deploy --s3-bucket my-modelling

Can you let me know what the correct syntax is to specify a folder?

Javide
  • 2,477
  • 5
  • 45
  • 61

1 Answers1

1

From docs:

Bucket names can consist only of lowercase letters, numbers, dots (.), and hyphens (-).

Therefore, your bucket name my-modelling/lambdas is incorrect since it contains /.

To add prefix use --s3-prefix:

Prefix added to the artifacts name that are uploaded to the Amazon S3 bucket. The prefix name is a path name (folder name) for the Amazon S3 bucket.

Marcin
  • 215,873
  • 14
  • 235
  • 294