Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/@aws-cdk/aws-amplify-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,18 @@ const amplifyApp = new amplify.App(this, 'MyApp', {
});
```

## Build Compute Type

You can specify the build compute type by setting the `buildComputeType` property.

For more information, see [Configuring the build instance for an Amplify application](https://docs.aws.amazon.com/amplify/latest/userguide/custom-build-instance.html).

```ts
const amplifyApp = new amplify.App(this, 'MyApp', {
buildComputeType: amplify.BuildComputeType.LARGE_16GB,
});
```

## Deploying Assets

`sourceCodeProvider` is optional; when this is not specified the Amplify app can be deployed to using `.zip` packages. The `asset` property can be used to deploy S3 assets to Amplify as part of the CDK:
Expand Down
30 changes: 30 additions & 0 deletions packages/@aws-cdk/aws-amplify-alpha/lib/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ export interface AppProps {
* @default undefined - a new role is created when `platform` is `Platform.WEB_COMPUTE` or `Platform.WEB_DYNAMIC`, otherwise no compute role
*/
readonly computeRole?: iam.IRole;

/**
* Specifies the size of the build instance.
*
* @default undefined - Amplify default setting is `BuildComputeType.STANDARD_8GB`.
*/
readonly buildComputeType?: BuildComputeType;
}

/**
Expand Down Expand Up @@ -311,6 +318,7 @@ export class App extends Resource implements IApp, iam.IGrantable {
repository: sourceCodeProviderOptions?.repository,
customHeaders: props.customResponseHeaders ? renderCustomResponseHeaders(props.customResponseHeaders, this) : undefined,
platform: appPlatform,
jobConfig: props.buildComputeType ? { buildComputeType: props.buildComputeType } : undefined,
});

this.appId = app.attrAppId;
Expand Down Expand Up @@ -648,3 +656,25 @@ export enum CacheConfigType {
*/
AMPLIFY_MANAGED_NO_COOKIES = 'AMPLIFY_MANAGED_NO_COOKIES',
}

/**
* Specifies the size of the build instance.
*
* @link https://docs.aws.amazon.com/amplify/latest/userguide/custom-build-instance.html
*/
export enum BuildComputeType {
/**
* vCPUs: 4, Memory: 8 GiB, Disk space: 128 GB
*/
STANDARD_8GB = 'STANDARD_8GB',

/**
* vCPUs: 8, Memory: 16 GiB, Disk space: 128 GB
*/
LARGE_16GB = 'LARGE_16GB',

/**
* vCPUs: 36, Memory: 72 GiB, Disk space: 256 GB
*/
XLARGE_72GB = 'XLARGE_72GB',
}
14 changes: 14 additions & 0 deletions packages/@aws-cdk/aws-amplify-alpha/test/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,3 +633,17 @@ test('throws when compute role is set with a non SSR app', () => {
});
}).toThrow('`computeRole` can only be specified for `Platform.WEB_COMPUTE` or `Platform.WEB_DYNAMIC`.');
});

test.each([amplify.BuildComputeType.STANDARD_8GB, amplify.BuildComputeType.LARGE_16GB, amplify.BuildComputeType.XLARGE_72GB])('create an app with buildComputeType is set to %s', (buildComputeType) => {
// WHEN
new amplify.App(stack, 'App', {
buildComputeType,
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Amplify::App', {
JobConfig: {
BuildComputeType: buildComputeType,
},
});
});
Loading
Loading