Skip to content

Commit cc1ddab

Browse files
authored
feat: Add the accelerate option for s3 buckets (#7314)
1 parent b8eb479 commit cc1ddab

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

.changeset/good-balloons-admire.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"app-builder-lib": minor
3+
"builder-util-runtime": minor
4+
---
5+
6+
added the accelerate option to handle accelerated s3 buckets

packages/app-builder-lib/scheme.json

+4
Original file line numberDiff line numberDiff line change
@@ -4882,6 +4882,10 @@
48824882
"additionalProperties": false,
48834883
"description": "[Amazon S3](https://aws.amazon.com/s3/) options.\nAWS credentials are required, please see [getting your credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html).\nDefine `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` [environment variables](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-environment.html).\nOr in the [~/.aws/credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html).\n\nExample configuration:\n\n```json\n{\n\"build\":\n \"publish\": {\n \"provider\": \"s3\",\n \"bucket\": \"bucket-name\"\n }\n}\n}\n```",
48844884
"properties": {
4885+
"accelerate": {
4886+
"description": "If set to true, this will enable the s3 accelerated endpoint\nThese endpoints have a particular format of:\n ${bucketname}.s3-accelerate.amazonaws.com",
4887+
"type": "boolean"
4888+
},
48854889
"acl": {
48864890
"anyOf": [
48874891
{

packages/builder-util-runtime/src/publishOptions.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,13 @@ export interface S3Options extends BaseS3Options {
349349
* The endpoint should be a string like `https://{service}.{region}.amazonaws.com`.
350350
*/
351351
readonly endpoint?: string | null
352+
353+
/**
354+
* If set to true, this will enable the s3 accelerated endpoint
355+
* These endpoints have a particular format of:
356+
* ${bucketname}.s3-accelerate.amazonaws.com
357+
*/
358+
readonly accelerate?: boolean
352359
}
353360

354361
/**
@@ -385,7 +392,9 @@ export function getS3LikeProviderBaseUrl(configuration: PublishConfiguration) {
385392

386393
function s3Url(options: S3Options) {
387394
let url: string
388-
if (options.endpoint != null) {
395+
if (options.accelerate == true) {
396+
url = `https://${options.bucket}.s3-accelerate.amazonaws.com`
397+
} else if (options.endpoint != null) {
389398
url = `${options.endpoint}/${options.bucket}`
390399
} else if (options.bucket.includes(".")) {
391400
if (options.region == null) {

0 commit comments

Comments
 (0)