Skip to content

Commit

Permalink
fix for non us-east-1 bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
thdxr committed Nov 24, 2023
1 parent d48d40a commit 2d96cf0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 13 additions & 2 deletions examples/test/sst.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@ export default {
};
},
async run() {
const bucket = new aws.s3.Bucket("my-bucket", {
bucket: "sst",
const bucket = new aws.s3.Bucket("my-bucket");

const west = new aws.Provider("west", {
region: "us-west-2",
});

new aws.s3.Bucket(
"my-bucket-west",
{},
{
provider: west,
},
);

return {
url: util.interpolate`https://${bucket.bucketDomainName}`,
};
Expand Down
4 changes: 4 additions & 0 deletions pkg/project/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/google/uuid"

"github.com/aws/aws-sdk-go-v2/service/s3"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
)

type bootstrap struct {
Expand Down Expand Up @@ -56,6 +57,9 @@ func (b *bootstrap) Bucket() (string, error) {

_, err := s3Client.CreateBucket(context.TODO(), &s3.CreateBucketInput{
Bucket: aws.String(bucketName),
CreateBucketConfiguration: &s3types.CreateBucketConfiguration{
LocationConstraint: s3types.BucketLocationConstraint(b.project.Region()),
},
})
if err != nil {
createErr = err
Expand Down

0 comments on commit 2d96cf0

Please sign in to comment.