konokenj.cdk-api-mcp-server 0.61.0__py3-none-any.whl → 0.63.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of konokenj.cdk-api-mcp-server might be problematic. Click here for more details.
- cdk_api_mcp_server/__about__.py +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-bedrock-agentcore-alpha/README.md +35 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-glue-alpha/README.md +3 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-imagebuilder-alpha/README.md +216 -11
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/mixins-preview/README.md +11 -11
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-appconfig/integ.configuration.ts +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-autoscaling/integ.asg-instance-termination-policy.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudformation/integ.core-custom-resources-node-18.ts +0 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudformation/integ.core-custom-resources.ts +0 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudformation/integ.nested-stack.ts +0 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudformation/integ.nested-stacks-assets.ts +0 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudformation/integ.nested-stacks-multi.ts +0 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-fleet-attribute-based-compute.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-fleet-custom-instance-type.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codepipeline-actions/integ.pipeline-code-commit-build.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codepipeline-actions/integ.pipeline-code-commit-custom-event.ts +10 -10
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codepipeline-actions/integ.pipeline-ecs-deploy.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/README.md +8 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/TABLE_V1_API.md +6 -6
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb-v2.policy.ts +9 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb.ts +1 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/README.md +34 -7
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/integ.instance-metadata-options.ts +51 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/integ.vpc-dual-stack-ec2.ts +0 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.fargate-with-efs.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-efs/integ.efs-filesystem-policy.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-efs/integ.efs.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancing/integ.instanceTarget.elb.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-globalaccelerator/integ.globalaccelerator-endpoints.ts +6 -6
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-globalaccelerator/integ.globalaccelerator-unique-name.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/README.md +210 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.capacity-provider-all-fields.ts +61 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.capacity-provider-defaults.ts +34 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.durable-config.ts +19 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.function-capacity-provider-all-fields.ts +57 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.function-capacity-provider-minimal.ts +42 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.lambda.filesystem.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.version-scaling-config-all-fields.ts +48 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-opensearchservice/integ.opensearch.min.ts +1 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/README.md +30 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/integ.failover-record.ts +48 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53-targets/integ.appsync-target.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.call-aws-service-cross-region.ts +7 -7
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.emr-create-cluster-with-v2-policy.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/integ.newpipeline-with-codebuild-logging.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/integ.newpipeline-with-codestar-connection.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/integ.newpipeline-with-cross-region-replication-buckets.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/integ.newpipeline-with-vpc.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/integ.newpipeline.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/integ.pipeline-with-artifact-bucket.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/integ.pipeline-with-variables.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/integ.pipeline-without-prepare.ts +1 -1
- {konokenj_cdk_api_mcp_server-0.61.0.dist-info → konokenj_cdk_api_mcp_server-0.63.0.dist-info}/METADATA +2 -2
- {konokenj_cdk_api_mcp_server-0.61.0.dist-info → konokenj_cdk_api_mcp_server-0.63.0.dist-info}/RECORD +57 -49
- {konokenj_cdk_api_mcp_server-0.61.0.dist-info → konokenj_cdk_api_mcp_server-0.63.0.dist-info}/WHEEL +1 -1
- {konokenj_cdk_api_mcp_server-0.61.0.dist-info → konokenj_cdk_api_mcp_server-0.63.0.dist-info}/entry_points.txt +0 -0
- {konokenj_cdk_api_mcp_server-0.61.0.dist-info → konokenj_cdk_api_mcp_server-0.63.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -211,12 +211,12 @@ To get the partition key and sort key of the table or indexes you have configure
|
|
|
211
211
|
```ts
|
|
212
212
|
declare const table: dynamodb.Table;
|
|
213
213
|
|
|
214
|
-
// For single keys, use schema() (deprecated for
|
|
214
|
+
// For single keys, use schema() (deprecated for multi-attribute keys)
|
|
215
215
|
const schema = table.schema();
|
|
216
216
|
const partitionKey = schema.partitionKey;
|
|
217
217
|
const sortKey = schema.sortKey;
|
|
218
218
|
|
|
219
|
-
// For
|
|
219
|
+
// For multi-attribute keys, use schemaV2() which returns normalized arrays
|
|
220
220
|
const schemaV2 = table.schemaV2();
|
|
221
221
|
const partitionKeys = schemaV2.partitionKeys; // Attribute[]
|
|
222
222
|
const sortKeys = schemaV2.sortKeys; // Attribute[]
|
|
@@ -225,11 +225,11 @@ const sortKeys = schemaV2.sortKeys; // Attribute[]
|
|
|
225
225
|
const indexSchema = table.schemaV2('INDEX_NAME');
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
-
Note: `schema()` is deprecated for indexes with
|
|
228
|
+
Note: `schema()` is deprecated for indexes with multi-attribute keys and will throw an error. Use `schemaV2()` instead, which always returns normalized arrays.
|
|
229
229
|
|
|
230
|
-
## Global Secondary Indexes with
|
|
230
|
+
## Global Secondary Indexes with multi-attribute Keys
|
|
231
231
|
|
|
232
|
-
Global secondary indexes support
|
|
232
|
+
Global secondary indexes support multi-attribute keys, allowing you to specify multiple partition keys and/or multiple sort keys. This enables more flexible query patterns for complex data models.
|
|
233
233
|
|
|
234
234
|
**Key Constraints:**
|
|
235
235
|
- You can specify up to **4 partition keys** per global secondary index
|
|
@@ -249,7 +249,7 @@ const table = new dynamodb.Table(this, 'Table', {
|
|
|
249
249
|
});
|
|
250
250
|
|
|
251
251
|
table.addGlobalSecondaryIndex({
|
|
252
|
-
indexName: '
|
|
252
|
+
indexName: 'multi-attribute-gsi',
|
|
253
253
|
partitionKeys: [
|
|
254
254
|
{ name: 'gsi_pk1', type: dynamodb.AttributeType.STRING },
|
|
255
255
|
{ name: 'gsi_pk2', type: dynamodb.AttributeType.NUMBER },
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb-v2.policy.ts
CHANGED
|
@@ -33,10 +33,18 @@ class TestStack extends Stack {
|
|
|
33
33
|
removalPolicy: RemovalPolicy.DESTROY,
|
|
34
34
|
resourcePolicy: docu,
|
|
35
35
|
});
|
|
36
|
+
|
|
37
|
+
const table = new dynamodb.TableV2(this, 'TableTestV2-2', {
|
|
38
|
+
partitionKey: {
|
|
39
|
+
name: 'id',
|
|
40
|
+
type: dynamodb.AttributeType.STRING,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
table.grantReadData(new iam.AccountRootPrincipal());
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
46
|
|
|
39
|
-
const stack = new TestStack(app, 'ResourcePolicyTest-v2'
|
|
47
|
+
const stack = new TestStack(app, 'ResourcePolicyTest-v2');
|
|
40
48
|
|
|
41
49
|
new IntegTest(app, 'table-v2-resource-policy-integ-test', {
|
|
42
50
|
testCases: [stack],
|
|
@@ -147,6 +147,7 @@ tableWithCMK.grantStreamRead(role);
|
|
|
147
147
|
|
|
148
148
|
const user = new iam.User(stack, 'User');
|
|
149
149
|
table.grantReadData(user);
|
|
150
|
+
table.grantReadData(new iam.AccountRootPrincipal());
|
|
150
151
|
tableWithGlobalAndLocalSecondaryIndex.grantReadData(user);
|
|
151
152
|
|
|
152
153
|
app.synth();
|
|
@@ -1939,30 +1939,57 @@ The `volumeInitializationRate` must be:
|
|
|
1939
1939
|
|
|
1940
1940
|
### Configuring Instance Metadata Service (IMDS)
|
|
1941
1941
|
|
|
1942
|
-
####
|
|
1942
|
+
#### Comprehensive Metadata Options
|
|
1943
1943
|
|
|
1944
|
-
You can configure [EC2 Instance Metadata Service](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) options
|
|
1945
|
-
allow both IMDSv1 and IMDSv2 or enforce IMDSv2 when interacting with the IMDS.
|
|
1946
|
-
|
|
1947
|
-
To do this for a single `Instance`, you can use the `requireImdsv2` property.
|
|
1948
|
-
The example below demonstrates IMDSv2 being required on a single `Instance`:
|
|
1944
|
+
You can configure [EC2 Instance Metadata Service](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) options using individual properties. This provides comprehensive control over all metadata service settings:
|
|
1949
1945
|
|
|
1950
1946
|
```ts
|
|
1951
1947
|
declare const vpc: ec2.Vpc;
|
|
1952
1948
|
declare const instanceType: ec2.InstanceType;
|
|
1953
1949
|
declare const machineImage: ec2.IMachineImage;
|
|
1954
1950
|
|
|
1951
|
+
// Example 1: Enforce IMDSv2 with comprehensive options
|
|
1955
1952
|
new ec2.Instance(this, 'Instance', {
|
|
1956
1953
|
vpc,
|
|
1957
1954
|
instanceType,
|
|
1958
1955
|
machineImage,
|
|
1956
|
+
httpEndpoint: true,
|
|
1957
|
+
httpProtocolIpv6: false,
|
|
1958
|
+
httpPutResponseHopLimit: 2,
|
|
1959
|
+
httpTokens: ec2.HttpTokens.REQUIRED,
|
|
1960
|
+
instanceMetadataTags: true,
|
|
1961
|
+
});
|
|
1959
1962
|
|
|
1960
|
-
|
|
1963
|
+
// Example 2: Enforce IMDSv2 with minimal configuration
|
|
1964
|
+
new ec2.Instance(this, 'SecureInstance', {
|
|
1965
|
+
vpc,
|
|
1966
|
+
instanceType,
|
|
1967
|
+
machineImage,
|
|
1968
|
+
httpTokens: ec2.HttpTokens.REQUIRED,
|
|
1969
|
+
});
|
|
1970
|
+
```
|
|
1971
|
+
|
|
1972
|
+
#### Simple IMDSv2 Enforcement
|
|
1973
|
+
|
|
1974
|
+
For simple IMDSv2 enforcement without additional configuration, you can use the `requireImdsv2` property:
|
|
1961
1975
|
|
|
1976
|
+
```ts
|
|
1977
|
+
declare const vpc: ec2.Vpc;
|
|
1978
|
+
declare const instanceType: ec2.InstanceType;
|
|
1979
|
+
declare const machineImage: ec2.IMachineImage;
|
|
1980
|
+
|
|
1981
|
+
new ec2.Instance(this, 'Instance', {
|
|
1982
|
+
vpc,
|
|
1983
|
+
instanceType,
|
|
1984
|
+
machineImage,
|
|
1985
|
+
|
|
1986
|
+
// Simple IMDSv2 enforcement
|
|
1962
1987
|
requireImdsv2: true,
|
|
1963
1988
|
});
|
|
1964
1989
|
```
|
|
1965
1990
|
|
|
1991
|
+
#### Applying to Multiple Instances
|
|
1992
|
+
|
|
1966
1993
|
You can also use the either the `InstanceRequireImdsv2Aspect` for EC2 instances or the `LaunchTemplateRequireImdsv2Aspect` for EC2 launch templates
|
|
1967
1994
|
to apply the operation to multiple instances or launch templates, respectively.
|
|
1968
1995
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as cdk from 'aws-cdk-lib';
|
|
2
|
+
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
3
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
4
|
+
|
|
5
|
+
const app = new cdk.App();
|
|
6
|
+
|
|
7
|
+
class TestStack extends cdk.Stack {
|
|
8
|
+
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
|
|
9
|
+
super(scope, id, props);
|
|
10
|
+
|
|
11
|
+
const vpc = new ec2.Vpc(this, 'VPC', {
|
|
12
|
+
maxAzs: 3,
|
|
13
|
+
natGateways: 1,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// Test instance with comprehensive metadata options
|
|
17
|
+
new ec2.Instance(this, 'InstanceWithMetadataOptions', {
|
|
18
|
+
vpc,
|
|
19
|
+
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.NANO),
|
|
20
|
+
machineImage: new ec2.AmazonLinuxImage({ generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 }),
|
|
21
|
+
httpEndpoint: true,
|
|
22
|
+
httpProtocolIpv6: false,
|
|
23
|
+
httpPutResponseHopLimit: 2,
|
|
24
|
+
httpTokens: ec2.HttpTokens.REQUIRED,
|
|
25
|
+
instanceMetadataTags: true,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Test instance with partial metadata options
|
|
29
|
+
new ec2.Instance(this, 'InstanceWithPartialMetadataOptions', {
|
|
30
|
+
vpc,
|
|
31
|
+
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.NANO),
|
|
32
|
+
machineImage: new ec2.AmazonLinuxImage({ generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 }),
|
|
33
|
+
httpTokens: ec2.HttpTokens.REQUIRED,
|
|
34
|
+
instanceMetadataTags: true,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Test instance with backward compatibility (requireImdsv2)
|
|
38
|
+
new ec2.Instance(this, 'InstanceWithRequireImdsv2', {
|
|
39
|
+
vpc,
|
|
40
|
+
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.NANO),
|
|
41
|
+
machineImage: new ec2.AmazonLinuxImage({ generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 }),
|
|
42
|
+
requireImdsv2: true,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const testCase = new TestStack(app, 'integ-ec2-instance-metadata-options');
|
|
48
|
+
|
|
49
|
+
new IntegTest(app, 'instance-metadata-options-test', {
|
|
50
|
+
testCases: [testCase],
|
|
51
|
+
});
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/integ.vpc-dual-stack-ec2.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Note: this integ test may take around 10 minutes to complete successfully.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
/* eslint-disable no-console */
|
|
6
5
|
import * as cdk from 'aws-cdk-lib';
|
|
7
6
|
import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
8
7
|
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.fargate-with-efs.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as efs from 'aws-cdk-lib/aws-efs';
|
|
|
3
3
|
import * as cdk from 'aws-cdk-lib';
|
|
4
4
|
import { Construct } from 'constructs';
|
|
5
5
|
import * as ecs from 'aws-cdk-lib/aws-ecs';
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
8
8
|
|
|
9
9
|
class FargateWithEfsStack extends cdk.Stack {
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-efs/integ.efs-filesystem-policy.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
2
2
|
import { AccountRootPrincipal, PolicyDocument, PolicyStatement } from 'aws-cdk-lib/aws-iam';
|
|
3
3
|
import * as cdk from 'aws-cdk-lib';
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
6
6
|
import { AccessPoint, FileSystem } from 'aws-cdk-lib/aws-efs';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
2
2
|
import * as cdk from 'aws-cdk-lib';
|
|
3
3
|
import { FileSystem } from 'aws-cdk-lib/aws-efs';
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
6
6
|
|
|
7
7
|
const app = new cdk.App();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
5
5
|
import * as cdk from 'aws-cdk-lib';
|
|
6
6
|
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
@@ -16,12 +16,12 @@ const stack = new Stack(app, 'global-accelerator-endpoints2');
|
|
|
16
16
|
const vpc = new Vpc(stack, 'Vpc');
|
|
17
17
|
const accelerator = new ga.Accelerator(stack, 'Accelerator');
|
|
18
18
|
const listener =
|
|
19
|
-
accelerator.addListener('Listener', {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
19
|
+
accelerator.addListener('Listener', {
|
|
20
|
+
portRanges: [
|
|
21
|
+
{ fromPort: 80 },
|
|
22
|
+
{ fromPort: 443 },
|
|
23
|
+
],
|
|
24
|
+
});
|
|
25
25
|
|
|
26
26
|
const alb = new ApplicationLoadBalancer(stack, 'ALB', { vpc });
|
|
27
27
|
alb.applyRemovalPolicy(RemovalPolicy.DESTROY);
|
|
@@ -733,6 +733,196 @@ new lambda.LayerVersion(this, 'MyLayer', {
|
|
|
733
733
|
});
|
|
734
734
|
```
|
|
735
735
|
|
|
736
|
+
## Capacity Providers
|
|
737
|
+
|
|
738
|
+
Lambda capacity providers allow you to run Lambda functions on dedicated compute resources instead of the default serverless execution environment. Capacity providers can have multiple functions and function versions associated with them, but a function can be attached to at most one capacity provider.
|
|
739
|
+
|
|
740
|
+
### Creating a Capacity Provider
|
|
741
|
+
|
|
742
|
+
To create a capacity provider, you need to specify the VPC configuration and optionally configure permissions, scaling, and instance requirements:
|
|
743
|
+
|
|
744
|
+
```ts
|
|
745
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
746
|
+
|
|
747
|
+
// Create a VPC for the capacity provider
|
|
748
|
+
const vpc = new ec2.Vpc(this, 'MyVpc');
|
|
749
|
+
const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { vpc });
|
|
750
|
+
|
|
751
|
+
// Create a basic capacity provider
|
|
752
|
+
const capacityProvider = new lambda.CapacityProvider(this, 'MyCapacityProvider', {
|
|
753
|
+
capacityProviderName: 'my-capacity-provider',
|
|
754
|
+
subnets: vpc.privateSubnets,
|
|
755
|
+
securityGroups: [securityGroup],
|
|
756
|
+
});
|
|
757
|
+
```
|
|
758
|
+
|
|
759
|
+
By default, permissions are granted to the capacity provider to manage instances using the AWS managed policy AWSLambdaManagedEC2ResourceOperator. You can also supply a custom role via the `operatorRole` parameter.
|
|
760
|
+
|
|
761
|
+
### Configuring Scaling Policies
|
|
762
|
+
|
|
763
|
+
You can configure target tracking scaling policies to automatically scale your capacity provider based on CPU utilization:
|
|
764
|
+
|
|
765
|
+
```ts
|
|
766
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
767
|
+
|
|
768
|
+
const vpc = new ec2.Vpc(this, 'MyVpc');
|
|
769
|
+
const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { vpc });
|
|
770
|
+
|
|
771
|
+
const capacityProvider = new lambda.CapacityProvider(this, 'MyCapacityProvider', {
|
|
772
|
+
subnets: vpc.privateSubnets,
|
|
773
|
+
securityGroups: [securityGroup],
|
|
774
|
+
scalingOptions: lambda.ScalingOptions.manual([
|
|
775
|
+
lambda.TargetTrackingScalingPolicy.cpuUtilization(70),
|
|
776
|
+
]),
|
|
777
|
+
});
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
### Instance Type Configuration
|
|
781
|
+
|
|
782
|
+
You can control which EC2 instance types the capacity provider can use:
|
|
783
|
+
|
|
784
|
+
```ts
|
|
785
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
786
|
+
|
|
787
|
+
const vpc = new ec2.Vpc(this, 'MyVpc');
|
|
788
|
+
const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { vpc });
|
|
789
|
+
|
|
790
|
+
// Allow only specific instance families
|
|
791
|
+
const allowCapacityProvider = new lambda.CapacityProvider(this, 'MyCapacityProviderAllowed', {
|
|
792
|
+
subnets: vpc.privateSubnets,
|
|
793
|
+
securityGroups: [securityGroup],
|
|
794
|
+
instanceTypeFilter: lambda.InstanceTypeFilter.allow([
|
|
795
|
+
ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE),
|
|
796
|
+
ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.XLARGE),
|
|
797
|
+
]),
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
// Or exclude specific instance types
|
|
801
|
+
const excludeCapacityProvider = new lambda.CapacityProvider(this, 'MyCapacityProviderExcluded', {
|
|
802
|
+
subnets: vpc.privateSubnets,
|
|
803
|
+
securityGroups: [securityGroup],
|
|
804
|
+
instanceTypeFilter: lambda.InstanceTypeFilter.exclude([
|
|
805
|
+
ec2.InstanceType.of(ec2.InstanceClass.T2, ec2.InstanceSize.MICRO),
|
|
806
|
+
]),
|
|
807
|
+
});
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
### Using a Capacity Provider with Lambda Functions
|
|
811
|
+
|
|
812
|
+
Once you have a capacity provider, you can configure Lambda functions to use it:
|
|
813
|
+
|
|
814
|
+
```ts
|
|
815
|
+
declare const capacityProvider: lambda.CapacityProvider;
|
|
816
|
+
|
|
817
|
+
const fn = new lambda.Function(this, 'MyFunction', {
|
|
818
|
+
// Runtime must be equal to or newer than NODEJS_22_X
|
|
819
|
+
runtime: lambda.Runtime.NODEJS_22_X,
|
|
820
|
+
handler: 'index.handler',
|
|
821
|
+
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
|
|
822
|
+
});
|
|
823
|
+
|
|
824
|
+
// Associate the function with the capacity provider
|
|
825
|
+
capacityProvider.addFunction(fn, {
|
|
826
|
+
perExecutionEnvironmentMaxConcurrency: 10,
|
|
827
|
+
executionEnvironmentMemoryGiBPerVCpu: 4,
|
|
828
|
+
});
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
Note that once you use a capacity provider in a function, it cannot be removed, only changed.
|
|
832
|
+
|
|
833
|
+
#### CapacityProviderFunctionOptions (addFunction method)
|
|
834
|
+
|
|
835
|
+
| Name | Type | Required | Description |
|
|
836
|
+
|------|------|----------|-------------|
|
|
837
|
+
| perExecutionEnvironmentMaxConcurrency | number | No | Maximum concurrent invokes per execution environment. |
|
|
838
|
+
| executionEnvironmentMemoryGiBPerVCpu | number | No | Memory per VCPU in GiB. |
|
|
839
|
+
| publishToLatestPublished | boolean | No | Whether to automatically publish to $LATEST.PUBLISHED version. |
|
|
840
|
+
| latestPublishedScalingConfig | LatestPublishedScalingConfig | No | Scaling configuration for $LATEST.PUBLISHED version. |
|
|
841
|
+
|
|
842
|
+
#### LatestPublishedScalingConfig
|
|
843
|
+
|
|
844
|
+
| Name | Type | Required | Description |
|
|
845
|
+
|------|------|----------|-------------|
|
|
846
|
+
| minExecutionEnvironments | number | No | Minimum execution environments for $LATEST.PUBLISHED version. |
|
|
847
|
+
| maxExecutionEnvironments | number | No | Maximum execution environments for $LATEST.PUBLISHED version. |
|
|
848
|
+
|
|
849
|
+
### Capacity Provider Versions
|
|
850
|
+
|
|
851
|
+
When publishing Lambda versions that use capacity providers, you can configure scaling settings specific to each version.
|
|
852
|
+
|
|
853
|
+
To publish a permanent version with specific scaling properties, you can use the [`currentVersion`](#currentversion-updated-hashing-logic) property of the function:
|
|
854
|
+
|
|
855
|
+
```ts
|
|
856
|
+
const fn = new lambda.Function(this, 'MyFunction', {
|
|
857
|
+
runtime: lambda.Runtime.NODEJS_22_X,
|
|
858
|
+
handler: 'index.handler',
|
|
859
|
+
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
|
|
860
|
+
currentVersionOptions: {
|
|
861
|
+
minExecutionEnvironments: 3,
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
|
|
865
|
+
const version = fn.latestVersion
|
|
866
|
+
```
|
|
867
|
+
|
|
868
|
+
You can also specify scaling properties for the special `$LATEST.PUBLISHED` version when attaching the function to the capacity provider.
|
|
869
|
+
|
|
870
|
+
`$LATEST.PUBLISHED` is a version that is automatically published when you deploy changes to your function.
|
|
871
|
+
|
|
872
|
+
```ts
|
|
873
|
+
declare const capacityProvider: lambda.CapacityProvider;
|
|
874
|
+
declare const fn: lambda.Function;
|
|
875
|
+
|
|
876
|
+
capacityProvider.addFunction(fn, {
|
|
877
|
+
latestPublishedScalingConfig: {
|
|
878
|
+
minExecutionEnvironments: 5,
|
|
879
|
+
maxExecutionEnvironments: 25,
|
|
880
|
+
},
|
|
881
|
+
});
|
|
882
|
+
```
|
|
883
|
+
|
|
884
|
+
#### VersionOptions (Capacity Provider Related Fields)
|
|
885
|
+
|
|
886
|
+
| Name | Type | Required | Description |
|
|
887
|
+
|------|------|----------|-------------|
|
|
888
|
+
| minExecutionEnvironments | number | No | Minimum execution environments to maintain for this version. |
|
|
889
|
+
| maxExecutionEnvironments | number | No | Maximum execution environments allowed for this version. |
|
|
890
|
+
|
|
891
|
+
### Security and Encryption
|
|
892
|
+
|
|
893
|
+
Capacity providers support encryption using AWS KMS keys:
|
|
894
|
+
|
|
895
|
+
```ts
|
|
896
|
+
import * as kms from 'aws-cdk-lib/aws-kms';
|
|
897
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
898
|
+
|
|
899
|
+
const vpc = new ec2.Vpc(this, 'MyVpc');
|
|
900
|
+
const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { vpc });
|
|
901
|
+
const kmsKey = new kms.Key(this, 'MyKey');
|
|
902
|
+
|
|
903
|
+
const capacityProvider = new lambda.CapacityProvider(this, 'MyCapacityProvider', {
|
|
904
|
+
subnets: vpc.privateSubnets,
|
|
905
|
+
securityGroups: [securityGroup],
|
|
906
|
+
kmsKey: kmsKey,
|
|
907
|
+
});
|
|
908
|
+
```
|
|
909
|
+
|
|
910
|
+
### Capacity Provider Configuration Reference
|
|
911
|
+
|
|
912
|
+
#### CapacityProviderProps
|
|
913
|
+
|
|
914
|
+
| Name | Type | Required | Description |
|
|
915
|
+
|------|------|----------|-------------|
|
|
916
|
+
| capacityProviderName | string | No | Name of the capacity provider. Must be unique within the AWS account and region. |
|
|
917
|
+
| securityGroups | ISecurityGroup[] | Yes | Security groups to associate with EC2 instances. Up to 5 allowed. |
|
|
918
|
+
| subnets | ISubnet[] | Yes | Subnets where the capacity provider can launch EC2 instances. 1-16 subnets supported. |
|
|
919
|
+
| operatorRole | IRole | No | IAM role for Lambda to manage the capacity provider. Uses AWS Managed Policy AWSLambdaManagedEC2ResourceOperator by default. |
|
|
920
|
+
| architectures | Architecture[] | No | Instruction set architecture for compute instances. |
|
|
921
|
+
| instanceTypeFilter | InstanceTypeFilter | No | Filter for allowed or excluded instance types. |
|
|
922
|
+
| maxVCpuCount | number | No | Maximum number of EC2 instances for scaling. |
|
|
923
|
+
| scalingOptions | ScalingOptions | No | Scaling configuration including policies. |
|
|
924
|
+
| kmsKey | IKey | No | KMS key for encrypting capacity provider data. |
|
|
925
|
+
|
|
736
926
|
## Lambda Insights
|
|
737
927
|
|
|
738
928
|
Lambda functions can be configured to use CloudWatch [Lambda Insights](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights.html)
|
|
@@ -1181,6 +1371,26 @@ const fn = new lambda.Function(this, 'MyFunction', {
|
|
|
1181
1371
|
const version = fn.currentVersion;
|
|
1182
1372
|
```
|
|
1183
1373
|
|
|
1374
|
+
## Lambda with Durable Configuration
|
|
1375
|
+
|
|
1376
|
+
Lambda functions can be configured with durability to enable long-running, stateful executions.
|
|
1377
|
+
|
|
1378
|
+
```ts
|
|
1379
|
+
const fn = new lambda.Function(this, 'MyFunction', {
|
|
1380
|
+
runtime: lambda.Runtime.NODEJS_24_X,
|
|
1381
|
+
handler: 'index.handler',
|
|
1382
|
+
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
|
|
1383
|
+
durableConfig: { executionTimeout: Duration.hours(1), retentionPeriod: Duration.days(30) }, // 1 hour timeout, 30 days retention
|
|
1384
|
+
});
|
|
1385
|
+
```
|
|
1386
|
+
*Note:* If adding the `durableConfig` property to an existing lambda function, a resource replacement will be triggered.
|
|
1387
|
+
For the resource replacement to succeed, you cannot explicitly set the `functionName` parameter, or else it will
|
|
1388
|
+
result in CloudFormation deployment errors. Modifying the parameters within `durableConfig` will not trigger a resource replacement.
|
|
1389
|
+
|
|
1390
|
+
*Further Note:* Deletion for durable functions will wait for all running executions to complete. CloudFormation will wait up to 1 hour,
|
|
1391
|
+
after which the stack update or deletion will timeout. If you have functions that are stuck deleting, please check if there
|
|
1392
|
+
are any running executions for the function.
|
|
1393
|
+
|
|
1184
1394
|
## AutoScaling
|
|
1185
1395
|
|
|
1186
1396
|
You can use Application AutoScaling to automatically configure the provisioned concurrency for your functions. AutoScaling can be set to track utilization or be based on a schedule. To configure AutoScaling on a function alias:
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
2
|
+
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
3
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
4
|
+
import * as cdk from 'aws-cdk-lib/core';
|
|
5
|
+
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
6
|
+
|
|
7
|
+
const app = new cdk.App();
|
|
8
|
+
const stack = new cdk.Stack(app, 'CapacityProviderAllFieldsStack');
|
|
9
|
+
|
|
10
|
+
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
|
|
11
|
+
const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { vpc });
|
|
12
|
+
|
|
13
|
+
const operatorRole = new iam.Role(stack, 'OperatorRole', {
|
|
14
|
+
assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'),
|
|
15
|
+
managedPolicies: [iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonLambdaCapacityProviderOperatorRolePolicy')],
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const capacityProvider = new lambda.CapacityProvider(stack, 'CapacityProvider', {
|
|
19
|
+
capacityProviderName: 'test-capacity-provider',
|
|
20
|
+
subnets: vpc.privateSubnets,
|
|
21
|
+
securityGroups: [securityGroup],
|
|
22
|
+
operatorRole: operatorRole,
|
|
23
|
+
architectures: [lambda.Architecture.X86_64],
|
|
24
|
+
instanceTypeFilter: lambda.InstanceTypeFilter.allow([ec2.InstanceType.of(ec2.InstanceClass.T2, ec2.InstanceSize.MICRO)]),
|
|
25
|
+
maxVCpuCount: 12,
|
|
26
|
+
scalingOptions: lambda.ScalingOptions.manual([
|
|
27
|
+
lambda.TargetTrackingScalingPolicy.cpuUtilization(70),
|
|
28
|
+
]),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const testCase = new integ.IntegTest(app, 'CapacityProviderAllFieldsTest', {
|
|
32
|
+
testCases: [stack],
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const getCapacityProvider = testCase.assertions.awsApiCall('Lambda', 'GetCapacityProvider', {
|
|
36
|
+
CapacityProviderName: capacityProvider.capacityProviderName,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
getCapacityProvider.expect(integ.ExpectedResult.objectLike({
|
|
40
|
+
CapacityProviderArn: capacityProvider.capacityProviderArn,
|
|
41
|
+
State: 'Active',
|
|
42
|
+
CapacityProviderScalingConfig: {
|
|
43
|
+
MaxVCpuCount: 12,
|
|
44
|
+
ScalingMode: 'Manual',
|
|
45
|
+
ScalingPolicies: [{
|
|
46
|
+
PredefinedMetricType: 'LambdaCapacityProviderAverageCPUUtilization',
|
|
47
|
+
TargetValue: 70,
|
|
48
|
+
}],
|
|
49
|
+
},
|
|
50
|
+
PermissionsConfig: {
|
|
51
|
+
CapacityProviderOperatorRoleArn: operatorRole.roleArn,
|
|
52
|
+
},
|
|
53
|
+
VpcConfig: {
|
|
54
|
+
SubnetIds: vpc.privateSubnets.map(subnet => subnet.subnetId),
|
|
55
|
+
SecurityGroupIds: [securityGroup.securityGroupId],
|
|
56
|
+
},
|
|
57
|
+
InstanceRequirements: {
|
|
58
|
+
Architectures: ['x86_64'],
|
|
59
|
+
AllowedInstanceTypes: ['t2.micro'],
|
|
60
|
+
},
|
|
61
|
+
}));
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
2
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
3
|
+
import * as cdk from 'aws-cdk-lib/core';
|
|
4
|
+
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
5
|
+
|
|
6
|
+
const app = new cdk.App();
|
|
7
|
+
const stack = new cdk.Stack(app, 'CapacityProviderDefaultsStack');
|
|
8
|
+
|
|
9
|
+
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
|
|
10
|
+
const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { vpc });
|
|
11
|
+
|
|
12
|
+
const capacityProvider = new lambda.CapacityProvider(stack, 'CapacityProvider', {
|
|
13
|
+
subnets: vpc.privateSubnets,
|
|
14
|
+
securityGroups: [securityGroup],
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const testCase = new integ.IntegTest(app, 'CapacityProviderDefaultsTest', {
|
|
18
|
+
testCases: [stack],
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const getCapacityProvider = testCase.assertions.awsApiCall('Lambda', 'GetCapacityProvider', {
|
|
22
|
+
CapacityProviderName: capacityProvider.capacityProviderName,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
getCapacityProvider.expect(integ.ExpectedResult.objectLike({
|
|
26
|
+
State: 'Active',
|
|
27
|
+
PermissionsConfig: {
|
|
28
|
+
CapacityProviderOperatorRoleArn: integ.ExpectedResult.stringLikeRegexp('arn:aws:iam::\\d{12}:role/.+'),
|
|
29
|
+
},
|
|
30
|
+
VpcConfig: {
|
|
31
|
+
SubnetIds: vpc.privateSubnets.map(subnet => subnet.subnetId),
|
|
32
|
+
SecurityGroupIds: [securityGroup.securityGroupId],
|
|
33
|
+
},
|
|
34
|
+
}));
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.durable-config.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
2
|
+
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
3
|
+
import { App, Stack, Duration } from 'aws-cdk-lib';
|
|
4
|
+
|
|
5
|
+
const app = new App();
|
|
6
|
+
const stack = new Stack(app, 'aws-cdk-lambda-durable-config');
|
|
7
|
+
|
|
8
|
+
new lambda.Function(stack, 'DurableFunction', {
|
|
9
|
+
runtime: lambda.Runtime.NODEJS_22_X,
|
|
10
|
+
handler: 'index.handler',
|
|
11
|
+
code: lambda.Code.fromInline('exports.handler = async () => ({ statusCode: 200, body: "Hello World" });'),
|
|
12
|
+
durableConfig: { executionTimeout: Duration.hours(1), retentionPeriod: Duration.days(30) },
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
new IntegTest(app, 'lambda-durable-config', {
|
|
16
|
+
testCases: [stack],
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
app.synth();
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
2
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
3
|
+
import * as cdk from 'aws-cdk-lib/core';
|
|
4
|
+
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
5
|
+
|
|
6
|
+
const app = new cdk.App();
|
|
7
|
+
const stack = new cdk.Stack(app, 'FunctionCapacityProviderAllFieldsStack');
|
|
8
|
+
|
|
9
|
+
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
|
|
10
|
+
const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { vpc });
|
|
11
|
+
|
|
12
|
+
const capacityProvider = new lambda.CapacityProvider(stack, 'CapacityProvider', {
|
|
13
|
+
subnets: vpc.privateSubnets,
|
|
14
|
+
securityGroups: [securityGroup],
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const fn = new lambda.Function(stack, 'Function', {
|
|
18
|
+
runtime: lambda.Runtime.NODEJS_LATEST,
|
|
19
|
+
handler: 'index.handler',
|
|
20
|
+
code: lambda.Code.fromInline('exports.handler = async () => ({ statusCode: 200 });'),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
capacityProvider.addFunction(fn, {
|
|
24
|
+
perExecutionEnvironmentMaxConcurrency: 10,
|
|
25
|
+
executionEnvironmentMemoryGiBPerVCpu: 2,
|
|
26
|
+
publishToLatestPublished: true,
|
|
27
|
+
latestPublishedScalingConfig: {
|
|
28
|
+
minExecutionEnvironments: 1,
|
|
29
|
+
maxExecutionEnvironments: 5,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const testCase = new integ.IntegTest(app, 'FunctionCapacityProviderAllFieldsTest', {
|
|
34
|
+
testCases: [stack],
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const getFunction = testCase.assertions.awsApiCall('Lambda', 'GetFunction', {
|
|
38
|
+
FunctionName: fn.functionName,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
getFunction.expect(integ.ExpectedResult.objectLike({
|
|
42
|
+
Configuration: {
|
|
43
|
+
State: 'Active',
|
|
44
|
+
PublishToLatestPublished: true,
|
|
45
|
+
CapacityProviderConfig: {
|
|
46
|
+
LambdaManagedInstancesCapacityProviderConfig: {
|
|
47
|
+
CapacityProviderArn: capacityProvider.capacityProviderArn,
|
|
48
|
+
PerExecutionEnvironmentMaxConcurrency: 10,
|
|
49
|
+
ExecutionEnvironmentMemoryGiBPerVCpu: 2,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
FunctionScalingConfig: {
|
|
53
|
+
MinExecutionEnvironments: 1,
|
|
54
|
+
MaxExecutionEnvironments: 5,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
}));
|