sigmus
sigmus

Reputation: 3237

How to deploy to a specific object key inside an S3 Bucket with the Serverless framework?

Serverless framework configuration allows:

deploymentBucket:
    name: foo

However, it always creates a serverless object key inside the foo bucket. I want to be able to deploy to a different key like BAR.

deploymentBucket:
    name: foo/BAR # illustration only, doesn't work

What are my options here?

Upvotes: 11

Views: 825

Answers (3)

Michał Zaborowski
Michał Zaborowski

Reputation: 4387

Here is example with putting index.html.

I'm not that much familiar with serverless framework, so hope it helps.

Upvotes: 0

Dan Kowalczyk
Dan Kowalczyk

Reputation: 4683

I found this sample config file and it contains a bucket name prefixed by a serverless module path.

deploymentBucket:
    name: com.serverless.${self:provider.region}.deploys # Deployment bucket name. Default is generated by the framework
    serverSideEncryption: AES256 # when using server-side encryption

This is a complete shot in the dark, but if you want to write to foo/BAR, maybe this setting would work for you:

name: com.serverless.${self:provider.region}.foo.BAR

EDIT: Does changing the package name affect which key the deployment is written to?

Upvotes: 2

Trent Bartlem
Trent Bartlem

Reputation: 2253

I don't believe Serverless has this functionality.

Your options are

  • Raise a GitHub issue and hope someone adds the functionality for you, or
  • Write a Serverless plugin that lets you add prefixes to the objects inside the deployment bucket

Upvotes: 5

Related Questions