Files
code-snippets/docs/b2/development-bucket.md
T
LiamPietralla db11e2e359
Build, Test & Publish / Build (push) Successful in 1m34s
Build, Test & Publish / Build and Publish Container Image (push) Successful in 3m1s
Build, Test & Publish / Deploy to Infrastructure (push) Successful in 29s
b2 setup
2026-06-18 17:45:15 +10:00

781 B

Development Bucket

To create a bucket for development that can be used by all origins we need to enable CORS for the bucket. First create the bucket and some access keys then download the b2-windows.exe tool from the website.

First login using the keys:

b2 authorize-account <accountId> <applicationKey>

Next lets set the cors rules for the bucket:

$rules =
@'
[
  {
    "corsRuleName": "allowall-s3",
    "allowedOrigins": ["*"],
    "allowedHeaders": ["*"],
    "allowedOperations": [
        "s3_get",
        "s3_put",
        "s3_head",
        "s3_delete"
    ],
    "exposeHeaders": ["ETag", "x-amz-server-side-encryption", "x-amz-request-id"],
    "maxAgeSeconds": 3600
  }
]
'@
b2 update-bucket --cors-rules $rules <bucketName>