Skip to content

Commit 780618e

Browse files
committed
add tests and README
1 parent 83197f8 commit 780618e

11 files changed

+512
-0
lines changed

packages/@aws-cdk/aws-amplify-alpha/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,23 @@ const amplifyApp = new amplify.App(this, 'MyApp', {
353353
});
354354
```
355355

356+
## Build Compute Type
357+
358+
You can specify the build compute type by setting the `buildComputeType` property:
359+
360+
```ts
361+
const amplifyApp = new amplify.App(this, 'MyApp', {
362+
buildComputeType: amplify.BuildComputeType.LARGE_16GB,
363+
});
364+
```
365+
366+
Available build compute types:
367+
- `STANDARD_8GB` - 4 vCPUs, 8 GiB Memory, 128 GB Disk space
368+
- `LARGE_16GB` - 8 vCPUs, 16 GiB Memory, 128 GB Disk space
369+
- `XLARGE_72GB` - 36 vCPUs, 72 GiB Memory, 128 GB Disk space
370+
371+
For more information, see [Configuring the build instance for an Amplify application](https://docs.aws.amazon.com/amplify/latest/userguide/custom-build-instance.html).
372+
356373
## Deploying Assets
357374

358375
`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:

packages/@aws-cdk/aws-amplify-alpha/test/app.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,3 +633,17 @@ test('throws when compute role is set with a non SSR app', () => {
633633
});
634634
}).toThrow('`computeRole` can only be specified for `Platform.WEB_COMPUTE` or `Platform.WEB_DYNAMIC`.');
635635
});
636+
637+
test.each([amplify.BuildComputeType.STANDARD_8GB, amplify.BuildComputeType.LARGE_16GB, amplify.BuildComputeType.XLARGE_72GB])('create an app with buildComputeType is set to %s', (buildComputeType) => {
638+
// WHEN
639+
new amplify.App(stack, 'App', {
640+
buildComputeType,
641+
});
642+
643+
// THEN
644+
Template.fromStack(stack).hasResourceProperties('AWS::Amplify::App', {
645+
JobConfig: {
646+
BuildComputeType: buildComputeType,
647+
},
648+
});
649+
});

packages/@aws-cdk/aws-amplify-alpha/test/integ.app-build-compute-type.js.snapshot/cdk-amplify-app-build-compute-type.assets.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
{
2+
"Resources": {
3+
"AppStandardRoleE2FE6E28": {
4+
"Type": "AWS::IAM::Role",
5+
"Properties": {
6+
"AssumeRolePolicyDocument": {
7+
"Statement": [
8+
{
9+
"Action": "sts:AssumeRole",
10+
"Effect": "Allow",
11+
"Principal": {
12+
"Service": "amplify.amazonaws.com"
13+
}
14+
}
15+
],
16+
"Version": "2012-10-17"
17+
}
18+
}
19+
},
20+
"AppStandard64C25109": {
21+
"Type": "AWS::Amplify::App",
22+
"Properties": {
23+
"BasicAuthConfig": {
24+
"EnableBasicAuth": false
25+
},
26+
"IAMServiceRole": {
27+
"Fn::GetAtt": [
28+
"AppStandardRoleE2FE6E28",
29+
"Arn"
30+
]
31+
},
32+
"JobConfig": {
33+
"BuildComputeType": "STANDARD_8GB"
34+
},
35+
"Name": "AppStandard",
36+
"Platform": "WEB"
37+
}
38+
},
39+
"AppLargeRoleF69E1D27": {
40+
"Type": "AWS::IAM::Role",
41+
"Properties": {
42+
"AssumeRolePolicyDocument": {
43+
"Statement": [
44+
{
45+
"Action": "sts:AssumeRole",
46+
"Effect": "Allow",
47+
"Principal": {
48+
"Service": "amplify.amazonaws.com"
49+
}
50+
}
51+
],
52+
"Version": "2012-10-17"
53+
}
54+
}
55+
},
56+
"AppLarge1965F25E": {
57+
"Type": "AWS::Amplify::App",
58+
"Properties": {
59+
"BasicAuthConfig": {
60+
"EnableBasicAuth": false
61+
},
62+
"IAMServiceRole": {
63+
"Fn::GetAtt": [
64+
"AppLargeRoleF69E1D27",
65+
"Arn"
66+
]
67+
},
68+
"JobConfig": {
69+
"BuildComputeType": "LARGE_16GB"
70+
},
71+
"Name": "AppLarge",
72+
"Platform": "WEB"
73+
}
74+
},
75+
"AppXLargeRoleF3215EF5": {
76+
"Type": "AWS::IAM::Role",
77+
"Properties": {
78+
"AssumeRolePolicyDocument": {
79+
"Statement": [
80+
{
81+
"Action": "sts:AssumeRole",
82+
"Effect": "Allow",
83+
"Principal": {
84+
"Service": "amplify.amazonaws.com"
85+
}
86+
}
87+
],
88+
"Version": "2012-10-17"
89+
}
90+
}
91+
},
92+
"AppXLarge0552F577": {
93+
"Type": "AWS::Amplify::App",
94+
"Properties": {
95+
"BasicAuthConfig": {
96+
"EnableBasicAuth": false
97+
},
98+
"IAMServiceRole": {
99+
"Fn::GetAtt": [
100+
"AppXLargeRoleF3215EF5",
101+
"Arn"
102+
]
103+
},
104+
"JobConfig": {
105+
"BuildComputeType": "XLARGE_72GB"
106+
},
107+
"Name": "AppXLarge",
108+
"Platform": "WEB"
109+
}
110+
}
111+
},
112+
"Parameters": {
113+
"BootstrapVersion": {
114+
"Type": "AWS::SSM::Parameter::Value<String>",
115+
"Default": "/cdk-bootstrap/hnb659fds/version",
116+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
117+
}
118+
},
119+
"Rules": {
120+
"CheckBootstrapVersion": {
121+
"Assertions": [
122+
{
123+
"Assert": {
124+
"Fn::Not": [
125+
{
126+
"Fn::Contains": [
127+
[
128+
"1",
129+
"2",
130+
"3",
131+
"4",
132+
"5"
133+
],
134+
{
135+
"Ref": "BootstrapVersion"
136+
}
137+
]
138+
}
139+
]
140+
},
141+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
142+
}
143+
]
144+
}
145+
}
146+
}

packages/@aws-cdk/aws-amplify-alpha/test/integ.app-build-compute-type.js.snapshot/cdk.out

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/aws-amplify-alpha/test/integ.app-build-compute-type.js.snapshot/cdkamplifyappbuildcomputetypeintegDefaultTestDeployAssert0B375296.assets.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/aws-amplify-alpha/test/integ.app-build-compute-type.js.snapshot/cdkamplifyappbuildcomputetypeintegDefaultTestDeployAssert0B375296.template.json

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/aws-amplify-alpha/test/integ.app-build-compute-type.js.snapshot/integ.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)