Hi, how do I use an existing S3 bucket? `const buc...
# general
Hi, how do I use an existing S3 bucket?
const bucket = new cloud.Bucket("<http://contextubot.net|contextubot.net>", { protect: true });
creates a new one with some random string 😕
@faint-application-2746 that is on purpose
you mean the name, right?
The name gets an auto-suffix so that you can deploy your app multiple times.
Also so that there aren’t name collisions generally.
Yeah, I understand that but sometimes a S3 bucket is fixed as name as other things write to it and it might even have pre-existing data
same behaviour is in serverless framework but they have serverless-plugin-existing-s3 to deal with that
I think if you want to use an existing S3 bucket, you can't use the cloud abstraction directly, today. You could use the get method on aws.s3.Bucket to retrieve an existing bucket, but you would unfortunately not get the nice
style methods. I think that some of the stuff @lemon-spoon-91807 is working on will make it easy to take an existing S3 bucket and then add handlers to it, similar to if how you created a
Here's how it will work RSN (i believe when our next release is)
1. You'll include
import * as aws from "@pulumi/aws"
const bucket = aws.s3.Bucket.get("yourbucketid")
❤️ 1
That will give you the real bucket resource.
if you want to do things like listen for events, you can do:
👍🏻 1