Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
28 changes: 28 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,23 @@ export enum CacheConfigType {
*/
AMPLIFY_MANAGED_NO_COOKIES = 'AMPLIFY_MANAGED_NO_COOKIES',
}

/**
* Specifies the size of the build instance.
*/
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: 128 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,
},
});
});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{
"Resources": {
"AppStandardRoleE2FE6E28": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "amplify.amazonaws.com"
}
}
],
"Version": "2012-10-17"
}
}
},
"AppStandard64C25109": {
"Type": "AWS::Amplify::App",
"Properties": {
"BasicAuthConfig": {
"EnableBasicAuth": false
},
"IAMServiceRole": {
"Fn::GetAtt": [
"AppStandardRoleE2FE6E28",
"Arn"
]
},
"JobConfig": {
"BuildComputeType": "STANDARD_8GB"
},
"Name": "AppStandard",
"Platform": "WEB"
}
},
"AppLargeRoleF69E1D27": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "amplify.amazonaws.com"
}
}
],
"Version": "2012-10-17"
}
}
},
"AppLarge1965F25E": {
"Type": "AWS::Amplify::App",
"Properties": {
"BasicAuthConfig": {
"EnableBasicAuth": false
},
"IAMServiceRole": {
"Fn::GetAtt": [
"AppLargeRoleF69E1D27",
"Arn"
]
},
"JobConfig": {
"BuildComputeType": "LARGE_16GB"
},
"Name": "AppLarge",
"Platform": "WEB"
}
},
"AppXLargeRoleF3215EF5": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "amplify.amazonaws.com"
}
}
],
"Version": "2012-10-17"
}
}
},
"AppXLarge0552F577": {
"Type": "AWS::Amplify::App",
"Properties": {
"BasicAuthConfig": {
"EnableBasicAuth": false
},
"IAMServiceRole": {
"Fn::GetAtt": [
"AppXLargeRoleF3215EF5",
"Arn"
]
},
"JobConfig": {
"BuildComputeType": "XLARGE_72GB"
},
"Name": "AppXLarge",
"Platform": "WEB"
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading