https://serverless-stack.com/ logo
#sst
Title
# sst
r

Ross Coundon

07/06/2021, 4:42 PM
I've added a bucket to an existing SST app but it's not getting created when I run
sst deploy
. I don't need to have any notifications attached to it. It's just going to be used to write data as a result of a call to an endpoint (also defined in SST) Is there anything I need to other than this:
Copy code
export default class SomeStack extends sst.Stack {
  constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
    super(scope, id, props);

    const statsCsvBucket = new Bucket(this, process.env.REBOOK_STATS_BUCKET);
  }
}
t

thdxr

07/06/2021, 4:49 PM
that's what I have
fyi that second argument won't be the bucket name, just how it's reference in CF
r

Ross Coundon

07/06/2021, 5:14 PM
Right, thanks. do I need to specify the name on the wrapped CDK construct?
t

thdxr

07/06/2021, 5:28 PM
Yeah but I usually just let it autoname and pass that name around. Here's how you'd do it though:
Copy code
const bucket = new sst.Bucket(stack, "lol", {
    s3Bucket: {
      bucketName: "lol"
    }
  })
r

Ross Coundon

07/06/2021, 5:33 PM
Have you ever added a bucket to an existing deployed stack using this method? Just wondering if it will only create a bucket on first deploy
or maybe I'm just looking for the wrong name (hadn't digested the implication of your naming comment!)
f

Frank

07/06/2021, 5:36 PM
@Ross Coundon, what you had should work.
r

Ross Coundon

07/06/2021, 5:36 PM
I'm possibly being an idiot
t

thdxr

07/06/2021, 5:36 PM
Yeah I have, it'll on create it once the part that's unique is that second argument. I wouldn't pass that through the env though
r

Ross Coundon

07/06/2021, 5:37 PM
yeah, got ya
f

Frank

07/06/2021, 5:37 PM
Two things I’d check: 1. run
sst diff
after you add it and see if the bucket shows up 2. look at the CF template in
.build/cdk.out
and see if you spot a AWS:S3:Bucket resource with the name