konokenj.cdk-api-mcp-server 0.54.0__py3-none-any.whl → 0.56.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 +880 -19
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-bedrock-alpha/README.md +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-imagebuilder-alpha/README.md +387 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/mixins-preview/README.md +53 -33
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.lambda-connect-disconnect-trigger.ts +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cognito/README.md +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/README.md +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr/README.md +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/README.md +44 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-opensearchservice/integ.opensearch.ebs.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/README.md +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.cluster-cloudwatch-logs-exports.ts +56 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/README.md +32 -31
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/integ.zone-delegation-iam-stack.ts +66 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-big-response.ts +4 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-data.ts +15 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-large-file.ts +3 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/README.md +56 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/integ.external-id.ts +80 -0
- {konokenj_cdk_api_mcp_server-0.54.0.dist-info → konokenj_cdk_api_mcp_server-0.56.0.dist-info}/METADATA +2 -2
- {konokenj_cdk_api_mcp_server-0.54.0.dist-info → konokenj_cdk_api_mcp_server-0.56.0.dist-info}/RECORD +25 -22
- {konokenj_cdk_api_mcp_server-0.54.0.dist-info → konokenj_cdk_api_mcp_server-0.56.0.dist-info}/WHEEL +0 -0
- {konokenj_cdk_api_mcp_server-0.54.0.dist-info → konokenj_cdk_api_mcp_server-0.56.0.dist-info}/entry_points.txt +0 -0
- {konokenj_cdk_api_mcp_server-0.54.0.dist-info → konokenj_cdk_api_mcp_server-0.56.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -1487,7 +1487,7 @@ Use the `grantProfileUsage` method to grant appropriate permissions to resources
|
|
|
1487
1487
|
// Create an application inference profile
|
|
1488
1488
|
const profile = new bedrock.ApplicationInferenceProfile(this, 'MyProfile', {
|
|
1489
1489
|
applicationInferenceProfileName: 'my-profile',
|
|
1490
|
-
modelSource: bedrock.BedrockFoundationModel.
|
|
1490
|
+
modelSource: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_SONNET_4_5_V1_0,
|
|
1491
1491
|
});
|
|
1492
1492
|
|
|
1493
1493
|
// Create a Lambda function
|
|
@@ -1503,7 +1503,7 @@ profile.grantProfileUsage(lambdaFunction);
|
|
|
1503
1503
|
// Use a system defined inference profile
|
|
1504
1504
|
const crossRegionProfile = bedrock.CrossRegionInferenceProfile.fromConfig({
|
|
1505
1505
|
geoRegion: bedrock.CrossRegionInferenceProfileRegion.US,
|
|
1506
|
-
model: bedrock.BedrockFoundationModel.
|
|
1506
|
+
model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_SONNET_4_5_V1_0,
|
|
1507
1507
|
});
|
|
1508
1508
|
|
|
1509
1509
|
// Grant permissions to use the cross-region inference profile
|
|
@@ -36,6 +36,250 @@ EC2 Image Builder supports AWS-managed components for common tasks, AWS Marketpl
|
|
|
36
36
|
that you create. Components run during specific workflow phases: build and validate phases during the build stage, and
|
|
37
37
|
test phase during the test stage.
|
|
38
38
|
|
|
39
|
+
### Component
|
|
40
|
+
|
|
41
|
+
A component defines the sequence of steps required to customize an instance during image creation (build component) or
|
|
42
|
+
test an instance launched from the created image (test component). Components are created from declarative YAML or JSON
|
|
43
|
+
documents that describe runtime configuration for building, validating, or testing instances. Components are included
|
|
44
|
+
when added to the image recipe or container recipe for an image build.
|
|
45
|
+
|
|
46
|
+
EC2 Image Builder supports AWS-managed components for common tasks, AWS Marketplace components, and custom components
|
|
47
|
+
that you create. Components run during specific workflow phases: build and validate phases during the build stage, and
|
|
48
|
+
test phase during the test stage.
|
|
49
|
+
|
|
50
|
+
#### Basic Usage
|
|
51
|
+
|
|
52
|
+
Create a component with the required properties: platform and component data.
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
const component = new imagebuilder.Component(this, 'MyComponent', {
|
|
56
|
+
platform: imagebuilder.Platform.LINUX,
|
|
57
|
+
data: imagebuilder.ComponentData.fromJsonObject({
|
|
58
|
+
schemaVersion: imagebuilder.ComponentSchemaVersion.V1_0,
|
|
59
|
+
phases: [
|
|
60
|
+
{
|
|
61
|
+
name: imagebuilder.ComponentPhaseName.BUILD,
|
|
62
|
+
steps: [
|
|
63
|
+
{
|
|
64
|
+
name: 'install-app',
|
|
65
|
+
action: imagebuilder.ComponentAction.EXECUTE_BASH,
|
|
66
|
+
inputs: {
|
|
67
|
+
commands: ['echo "Installing my application..."', 'yum update -y'],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
}),
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### Component Data Sources
|
|
78
|
+
|
|
79
|
+
##### Inline Component Data
|
|
80
|
+
|
|
81
|
+
Use `ComponentData.fromInline()` for existing YAML/JSON definitions:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
const component = new imagebuilder.Component(this, 'InlineComponent', {
|
|
85
|
+
platform: imagebuilder.Platform.LINUX,
|
|
86
|
+
data: imagebuilder.ComponentData.fromInline(`
|
|
87
|
+
name: my-component
|
|
88
|
+
schemaVersion: 1.0
|
|
89
|
+
phases:
|
|
90
|
+
- name: build
|
|
91
|
+
steps:
|
|
92
|
+
- name: update-os
|
|
93
|
+
action: ExecuteBash
|
|
94
|
+
inputs:
|
|
95
|
+
commands: ['yum update -y']
|
|
96
|
+
`)
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
##### JSON Object Component Data
|
|
101
|
+
|
|
102
|
+
Most developer-friendly approach using objects:
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
|
|
106
|
+
const component = new imagebuilder.Component(this, 'JsonComponent', {
|
|
107
|
+
platform: imagebuilder.Platform.LINUX,
|
|
108
|
+
data: imagebuilder.ComponentData.fromJsonObject({
|
|
109
|
+
schemaVersion: imagebuilder.ComponentSchemaVersion.V1_0,
|
|
110
|
+
phases: [
|
|
111
|
+
{
|
|
112
|
+
name: imagebuilder.ComponentPhaseName.BUILD,
|
|
113
|
+
steps: [
|
|
114
|
+
{
|
|
115
|
+
name: 'configure-app',
|
|
116
|
+
action: imagebuilder.ComponentAction.CREATE_FILE,
|
|
117
|
+
inputs: {
|
|
118
|
+
path: '/etc/myapp/config.json',
|
|
119
|
+
content: '{"env": "production"}'
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
##### Structured Component Document
|
|
130
|
+
|
|
131
|
+
For type-safe, CDK-native definitions with enhanced properties like `timeout` and `onFailure`.
|
|
132
|
+
|
|
133
|
+
###### Defining a component step
|
|
134
|
+
|
|
135
|
+
You can define steps in the component which will be executed in order when the component is applied:
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
const step: imagebuilder.ComponentDocumentStep = {
|
|
139
|
+
name: 'configure-app',
|
|
140
|
+
action: imagebuilder.ComponentAction.CREATE_FILE,
|
|
141
|
+
inputs: imagebuilder.ComponentStepInputs.fromObject({
|
|
142
|
+
path: '/etc/myapp/config.json',
|
|
143
|
+
content: '{"env": "production"}'
|
|
144
|
+
})
|
|
145
|
+
};
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
###### Defining a component phase
|
|
149
|
+
|
|
150
|
+
Phases group steps together, which run in sequence when building, validating or testing in the component:
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
const phase: imagebuilder.ComponentDocumentPhase = {
|
|
154
|
+
name: imagebuilder.ComponentPhaseName.BUILD,
|
|
155
|
+
steps: [
|
|
156
|
+
{
|
|
157
|
+
name: 'configure-app',
|
|
158
|
+
action: imagebuilder.ComponentAction.CREATE_FILE,
|
|
159
|
+
inputs: imagebuilder.ComponentStepInputs.fromObject({
|
|
160
|
+
path: '/etc/myapp/config.json',
|
|
161
|
+
content: '{"env": "production"}'
|
|
162
|
+
})
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
};
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
###### Defining a component
|
|
169
|
+
|
|
170
|
+
The component data defines all steps across the provided phases to execute during the build:
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
const component = new imagebuilder.Component(this, 'StructuredComponent', {
|
|
174
|
+
platform: imagebuilder.Platform.LINUX,
|
|
175
|
+
data: imagebuilder.ComponentData.fromComponentDocumentJsonObject({
|
|
176
|
+
schemaVersion: imagebuilder.ComponentSchemaVersion.V1_0,
|
|
177
|
+
phases: [
|
|
178
|
+
{
|
|
179
|
+
name: imagebuilder.ComponentPhaseName.BUILD,
|
|
180
|
+
steps: [
|
|
181
|
+
{
|
|
182
|
+
name: 'install-with-timeout',
|
|
183
|
+
action: imagebuilder.ComponentAction.EXECUTE_BASH,
|
|
184
|
+
timeout: Duration.minutes(10),
|
|
185
|
+
onFailure: imagebuilder.ComponentOnFailure.CONTINUE,
|
|
186
|
+
inputs: imagebuilder.ComponentStepInputs.fromObject({
|
|
187
|
+
commands: ['./install-script.sh']
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
})
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
##### S3 Component Data
|
|
198
|
+
|
|
199
|
+
For those components you want to upload or have uploaded to S3:
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
// Upload a local file
|
|
203
|
+
const componentFromAsset = new imagebuilder.Component(this, 'AssetComponent', {
|
|
204
|
+
platform: imagebuilder.Platform.LINUX,
|
|
205
|
+
data: imagebuilder.ComponentData.fromAsset(this, 'ComponentAsset', './my-component.yml'),
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
// Reference an existing S3 object
|
|
209
|
+
const bucket = s3.Bucket.fromBucketName(this, 'ComponentBucket', 'my-components-bucket');
|
|
210
|
+
const componentFromS3 = new imagebuilder.Component(this, 'S3Component', {
|
|
211
|
+
platform: imagebuilder.Platform.LINUX,
|
|
212
|
+
data: imagebuilder.ComponentData.fromS3(bucket, 'components/my-component.yml'),
|
|
213
|
+
});
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
#### Encrypt component data with a KMS key
|
|
217
|
+
|
|
218
|
+
You can encrypt component data with a KMS key, so that only principals with access to decrypt with the key are able to
|
|
219
|
+
access the component data.
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
const component = new imagebuilder.Component(this, 'EncryptedComponent', {
|
|
223
|
+
platform: imagebuilder.Platform.LINUX,
|
|
224
|
+
kmsKey: new kms.Key(this, 'ComponentKey'),
|
|
225
|
+
data: imagebuilder.ComponentData.fromJsonObject({
|
|
226
|
+
schemaVersion: imagebuilder.ComponentSchemaVersion.V1_0,
|
|
227
|
+
phases: [
|
|
228
|
+
{
|
|
229
|
+
name: imagebuilder.ComponentPhaseName.BUILD,
|
|
230
|
+
steps: [
|
|
231
|
+
{
|
|
232
|
+
name: 'secure-setup',
|
|
233
|
+
action: imagebuilder.ComponentAction.EXECUTE_BASH,
|
|
234
|
+
inputs: {
|
|
235
|
+
commands: ['echo "This component data is encrypted with KMS"'],
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
}),
|
|
242
|
+
});
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### AWS-Managed Components
|
|
246
|
+
|
|
247
|
+
AWS provides a collection of managed components for common tasks:
|
|
248
|
+
|
|
249
|
+
```ts
|
|
250
|
+
// Install AWS CLI v2
|
|
251
|
+
const awsCliComponent = imagebuilder.AwsManagedComponent.awsCliV2(this, 'AwsCli', {
|
|
252
|
+
platform: imagebuilder.Platform.LINUX
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// Update the operating system
|
|
256
|
+
const updateComponent = imagebuilder.AwsManagedComponent.updateOS(this, 'UpdateOS', {
|
|
257
|
+
platform: imagebuilder.Platform.LINUX
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
// Reference any AWS-managed component by name
|
|
261
|
+
const customAwsComponent = imagebuilder.AwsManagedComponent.fromAwsManagedComponentName(
|
|
262
|
+
this,
|
|
263
|
+
'CloudWatchAgent',
|
|
264
|
+
'amazon-cloudwatch-agent-linux'
|
|
265
|
+
);
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
#### AWS Marketplace Components
|
|
269
|
+
|
|
270
|
+
You can reference AWS Marketplace components using the marketplace component name and its product ID:
|
|
271
|
+
|
|
272
|
+
```ts
|
|
273
|
+
const marketplaceComponent = imagebuilder.AwsMarketplaceComponent.fromAwsMarketplaceComponentAttributes(
|
|
274
|
+
this,
|
|
275
|
+
'MarketplaceComponent',
|
|
276
|
+
{
|
|
277
|
+
componentName: 'my-marketplace-component',
|
|
278
|
+
marketplaceProductId: 'prod-1234567890abcdef0',
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
```
|
|
282
|
+
|
|
39
283
|
### Infrastructure Configuration
|
|
40
284
|
|
|
41
285
|
Infrastructure configuration defines the compute resources and environment settings used during the image building
|
|
@@ -92,3 +336,146 @@ const infrastructureConfiguration = new imagebuilder.InfrastructureConfiguration
|
|
|
92
336
|
}
|
|
93
337
|
});
|
|
94
338
|
```
|
|
339
|
+
|
|
340
|
+
### Distribution Configuration
|
|
341
|
+
|
|
342
|
+
Distribution configuration defines how and where your built images are distributed after successful creation. For AMIs,
|
|
343
|
+
this includes target AWS Regions, KMS encryption keys, account sharing permissions, License Manager associations, and
|
|
344
|
+
launch template configurations. For container images, it specifies the target Amazon ECR repositories across regions.
|
|
345
|
+
A distribution configuration can be associated with an image or an image pipeline to define these distribution settings
|
|
346
|
+
for image builds.
|
|
347
|
+
|
|
348
|
+
#### AMI Distributions
|
|
349
|
+
|
|
350
|
+
AMI distributions can be defined to copy and modify AMIs in different accounts and regions, and apply them to launch
|
|
351
|
+
templates, SSM parameters, etc.:
|
|
352
|
+
|
|
353
|
+
```ts
|
|
354
|
+
const distributionConfiguration = new imagebuilder.DistributionConfiguration(this, 'DistributionConfiguration', {
|
|
355
|
+
distributionConfigurationName: 'test-distribution-configuration',
|
|
356
|
+
description: 'A Distribution Configuration',
|
|
357
|
+
amiDistributions: [
|
|
358
|
+
{
|
|
359
|
+
// Distribute AMI to us-east-2 and publish the AMI ID to an SSM parameter
|
|
360
|
+
region: 'us-east-2',
|
|
361
|
+
ssmParameters: [
|
|
362
|
+
{
|
|
363
|
+
parameter: ssm.StringParameter.fromStringParameterAttributes(this, 'CrossRegionParameter', {
|
|
364
|
+
parameterName: '/imagebuilder/ami',
|
|
365
|
+
forceDynamicReference: true
|
|
366
|
+
})
|
|
367
|
+
}
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
]
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
// For AMI-based image builds - add an AMI distribution in the current region
|
|
374
|
+
distributionConfiguration.addAmiDistributions({
|
|
375
|
+
amiName: 'imagebuilder-{{ imagebuilder:buildDate }}',
|
|
376
|
+
amiDescription: 'Build AMI',
|
|
377
|
+
amiKmsKey: kms.Key.fromLookup(this, 'ComponentKey', { aliasName: 'alias/distribution-encryption-key' }),
|
|
378
|
+
// Copy the AMI to different accounts
|
|
379
|
+
amiTargetAccountIds: ['123456789012', '098765432109'],
|
|
380
|
+
// Add launch permissions on the AMI
|
|
381
|
+
amiLaunchPermission: {
|
|
382
|
+
organizationArns: [
|
|
383
|
+
this.formatArn({ region: '', service: 'organizations', resource: 'organization', resourceName: 'o-1234567abc' })
|
|
384
|
+
],
|
|
385
|
+
organizationalUnitArns: [
|
|
386
|
+
this.formatArn({
|
|
387
|
+
region: '',
|
|
388
|
+
service: 'organizations',
|
|
389
|
+
resource: 'ou',
|
|
390
|
+
resourceName: 'o-1234567abc/ou-a123-b4567890'
|
|
391
|
+
})
|
|
392
|
+
],
|
|
393
|
+
isPublicUserGroup: true,
|
|
394
|
+
accountIds: ['234567890123']
|
|
395
|
+
},
|
|
396
|
+
// Attach tags to the AMI
|
|
397
|
+
amiTags: {
|
|
398
|
+
Environment: 'production',
|
|
399
|
+
Version: '{{ imagebuilder:buildVersion }}'
|
|
400
|
+
},
|
|
401
|
+
// Optional - publish the distributed AMI ID to an SSM parameter
|
|
402
|
+
ssmParameters: [
|
|
403
|
+
{
|
|
404
|
+
parameter: ssm.StringParameter.fromStringParameterAttributes(this, 'Parameter', {
|
|
405
|
+
parameterName: '/imagebuilder/ami',
|
|
406
|
+
forceDynamicReference: true
|
|
407
|
+
})
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
amiAccount: '098765432109',
|
|
411
|
+
dataType: ssm.ParameterDataType.TEXT,
|
|
412
|
+
parameter: ssm.StringParameter.fromStringParameterAttributes(this, 'CrossAccountParameter', {
|
|
413
|
+
parameterName: 'imagebuilder-prod-ami',
|
|
414
|
+
forceDynamicReference: true
|
|
415
|
+
})
|
|
416
|
+
}
|
|
417
|
+
],
|
|
418
|
+
// Optional - create a new launch template version with the distributed AMI ID
|
|
419
|
+
launchTemplates: [
|
|
420
|
+
{
|
|
421
|
+
launchTemplate: ec2.LaunchTemplate.fromLaunchTemplateAttributes(this, 'LaunchTemplate', {
|
|
422
|
+
launchTemplateId: 'lt-1234'
|
|
423
|
+
}),
|
|
424
|
+
setDefaultVersion: true
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
accountId: '123456789012',
|
|
428
|
+
launchTemplate: ec2.LaunchTemplate.fromLaunchTemplateAttributes(this, 'CrossAccountLaunchTemplate', {
|
|
429
|
+
launchTemplateId: 'lt-5678'
|
|
430
|
+
}),
|
|
431
|
+
setDefaultVersion: true
|
|
432
|
+
}
|
|
433
|
+
],
|
|
434
|
+
// Optional - enable Fast Launch on an imported launch template
|
|
435
|
+
fastLaunchConfigurations: [
|
|
436
|
+
{
|
|
437
|
+
enabled: true,
|
|
438
|
+
launchTemplate: ec2.LaunchTemplate.fromLaunchTemplateAttributes(this, 'FastLaunchLT', {
|
|
439
|
+
launchTemplateName: 'fast-launch-lt'
|
|
440
|
+
}),
|
|
441
|
+
maxParallelLaunches: 10,
|
|
442
|
+
targetSnapshotCount: 2
|
|
443
|
+
}
|
|
444
|
+
],
|
|
445
|
+
// Optional - license configurations to apply to the AMI
|
|
446
|
+
licenseConfigurationArns: [
|
|
447
|
+
'arn:aws:license-manager:us-west-2:123456789012:license-configuration:lic-abcdefghijklmnopqrstuvwxyz'
|
|
448
|
+
]
|
|
449
|
+
});
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
#### Container Distributions
|
|
453
|
+
|
|
454
|
+
##### Container repositories
|
|
455
|
+
|
|
456
|
+
Container distributions can be configured to distribute to ECR repositories:
|
|
457
|
+
|
|
458
|
+
```ts
|
|
459
|
+
const ecrRepository = ecr.Repository.fromRepositoryName(this, 'ECRRepository', 'my-repo');
|
|
460
|
+
const imageBuilderRepository = imagebuilder.Repository.fromEcr(ecrRepository);
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
##### Defining a container distribution
|
|
464
|
+
|
|
465
|
+
You can configure the container repositories as well as the description and tags applied to the distributed container
|
|
466
|
+
images:
|
|
467
|
+
|
|
468
|
+
```ts
|
|
469
|
+
const ecrRepository = ecr.Repository.fromRepositoryName(this, 'ECRRepository', 'my-repo');
|
|
470
|
+
const containerRepository = imagebuilder.Repository.fromEcr(ecrRepository);
|
|
471
|
+
const containerDistributionConfiguration = new imagebuilder.DistributionConfiguration(
|
|
472
|
+
this,
|
|
473
|
+
'ContainerDistributionConfiguration'
|
|
474
|
+
);
|
|
475
|
+
|
|
476
|
+
containerDistributionConfiguration.addContainerDistributions({
|
|
477
|
+
containerRepository,
|
|
478
|
+
containerDescription: 'Test container image',
|
|
479
|
+
containerTags: ['latest', 'latest-1.0']
|
|
480
|
+
});
|
|
481
|
+
```
|
|
@@ -37,6 +37,22 @@ Mixins.of(bucket)
|
|
|
37
37
|
.apply(new AutoDeleteObjects());
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
### Fluent Syntax with `.with()`
|
|
41
|
+
|
|
42
|
+
For convenience, you can use the `.with()` method for a more fluent syntax:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import '@aws-cdk/mixins-preview/with';
|
|
46
|
+
|
|
47
|
+
const bucket = new s3.CfnBucket(scope, "MyBucket")
|
|
48
|
+
.with(new EnableVersioning())
|
|
49
|
+
.with(new AutoDeleteObjects());
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The `.with()` method is available after importing `@aws-cdk/mixins-preview/with`, which augments all constructs with this method. It provides the same functionality as `Mixins.of().apply()` but with a more chainable API.
|
|
53
|
+
|
|
54
|
+
> **Note**: The `.with()` fluent syntax is only available in JavaScript and TypeScript. Other jsii languages (Python, Java, C#, and Go) should use the `Mixins.of(...).mustApply()` syntax instead. The import requirement is temporary during the preview phase. Once the API is stable, the `.with()` method will be available by default on all constructs and in all languages.
|
|
55
|
+
|
|
40
56
|
## Creating Custom Mixins
|
|
41
57
|
|
|
42
58
|
Mixins are simple classes that implement the `IMixin` interface:
|
|
@@ -109,15 +125,46 @@ const bucket = new s3.CfnBucket(scope, "Bucket");
|
|
|
109
125
|
Mixins.of(bucket).apply(new EnableVersioning());
|
|
110
126
|
```
|
|
111
127
|
|
|
112
|
-
###
|
|
128
|
+
### L1 Property Mixins
|
|
113
129
|
|
|
114
|
-
|
|
130
|
+
For every CloudFormation resource, CDK Mixins automatically generates type-safe property mixins. These allow you to apply L1 properties with full TypeScript support:
|
|
115
131
|
|
|
116
132
|
```typescript
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
133
|
+
import '@aws-cdk/mixins-preview/with';
|
|
134
|
+
import { CfnBucketPropsMixin } from '@aws-cdk/mixins-preview/aws-s3/mixins';
|
|
135
|
+
|
|
136
|
+
const bucket = new s3.Bucket(scope, "Bucket")
|
|
137
|
+
.with(new CfnBucketPropsMixin({
|
|
138
|
+
versioningConfiguration: { status: "Enabled" },
|
|
139
|
+
publicAccessBlockConfiguration: {
|
|
140
|
+
blockPublicAcls: true,
|
|
141
|
+
blockPublicPolicy: true
|
|
142
|
+
}
|
|
143
|
+
}));
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Property mixins support two merge strategies:
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
// MERGE (default): Deep merges properties with existing values
|
|
150
|
+
Mixins.of(bucket).apply(new CfnBucketPropsMixin(
|
|
151
|
+
{ versioningConfiguration: { status: "Enabled" } },
|
|
152
|
+
{ strategy: PropertyMergeStrategy.MERGE }
|
|
153
|
+
));
|
|
154
|
+
|
|
155
|
+
// OVERWRITE: Replaces existing property values
|
|
156
|
+
Mixins.of(bucket).apply(new CfnBucketPropsMixin(
|
|
157
|
+
{ versioningConfiguration: { status: "Enabled" } },
|
|
158
|
+
{ strategy: PropertyMergeStrategy.OVERWRITE }
|
|
159
|
+
));
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Property mixins are available for all AWS services:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
import { CfnLogGroupMixin } from '@aws-cdk/mixins-preview/aws-logs/mixins';
|
|
166
|
+
import { CfnFunctionMixin } from '@aws-cdk/mixins-preview/aws-lambda/mixins';
|
|
167
|
+
import { CfnTableMixin } from '@aws-cdk/mixins-preview/aws-dynamodb/mixins';
|
|
121
168
|
```
|
|
122
169
|
|
|
123
170
|
## Error Handling
|
|
@@ -133,30 +180,3 @@ Mixins.of(scope)
|
|
|
133
180
|
Mixins.of(scope)
|
|
134
181
|
.mustApply(new EncryptionAtRest()); // Throws if no constructs support the mixin
|
|
135
182
|
```
|
|
136
|
-
|
|
137
|
-
## API Reference
|
|
138
|
-
|
|
139
|
-
### Core Interfaces
|
|
140
|
-
|
|
141
|
-
* `IMixin` - Interface that all mixins must implement
|
|
142
|
-
* `Mixins` - Main entry point for applying mixins
|
|
143
|
-
* `ConstructSelector` - Selects constructs from a tree based on criteria
|
|
144
|
-
* `MixinApplicator` - Applies mixins to selected constructs
|
|
145
|
-
|
|
146
|
-
### Mixins
|
|
147
|
-
|
|
148
|
-
* `EncryptionAtRest` - Cross-service encryption mixin
|
|
149
|
-
* `AutoDeleteObjects` - S3 auto-delete objects mixin
|
|
150
|
-
* `EnableVersioning` - S3 versioning mixin
|
|
151
|
-
* `CfnPropertiesMixin` - Generic CloudFormation properties mixin
|
|
152
|
-
|
|
153
|
-
### Selectors
|
|
154
|
-
|
|
155
|
-
* `ConstructSelector.all()` - Select all constructs
|
|
156
|
-
* `ConstructSelector.cfnResource()` - Select CfnResource constructs
|
|
157
|
-
* `ConstructSelector.resourcesOfType()` - Select by type
|
|
158
|
-
* `ConstructSelector.byId()` - Select by ID pattern
|
|
159
|
-
|
|
160
|
-
## License
|
|
161
|
-
|
|
162
|
-
This project is licensed under the Apache-2.0 License.
|
|
@@ -17,7 +17,7 @@ const webSocketTableName = 'WebSocketConnections';
|
|
|
17
17
|
|
|
18
18
|
const connectFunction = new lambda.Function(stack, 'Connect Function', {
|
|
19
19
|
functionName: 'process_connect_requests',
|
|
20
|
-
runtime: lambda.Runtime.
|
|
20
|
+
runtime: lambda.Runtime.NODEJS_22_X,
|
|
21
21
|
handler: 'index.handler',
|
|
22
22
|
code: lambda.Code.fromAsset(path.join(__dirname, 'lambdas', 'connect')),
|
|
23
23
|
timeout: cdk.Duration.seconds(5),
|
|
@@ -31,7 +31,7 @@ const disconnectFunction = new lambda.Function(
|
|
|
31
31
|
'Disconnect Function',
|
|
32
32
|
{
|
|
33
33
|
functionName: 'process_disconnect_requests',
|
|
34
|
-
runtime: lambda.Runtime.
|
|
34
|
+
runtime: lambda.Runtime.NODEJS_22_X,
|
|
35
35
|
handler: 'index.handler',
|
|
36
36
|
code: lambda.Code.fromAsset(
|
|
37
37
|
path.join(__dirname, 'lambdas', 'disconnect'),
|
|
@@ -480,13 +480,13 @@ new cognito.UserPool(this, 'myuserpool', {
|
|
|
480
480
|
|
|
481
481
|
### Threat Protection
|
|
482
482
|
|
|
483
|
-
This feature is only available if your Feature Plan is set to PLUS.
|
|
484
|
-
|
|
485
483
|
Threat Protection can be set to configure enforcement levels and automatic responses for users in password-based and custom-challenge authentication flows.
|
|
486
484
|
For configuration, there are 2 options for standard authentication and custom authentication.
|
|
487
485
|
These are represented with properties `standardThreatProtectionMode` and `customThreatProtectionMode`.
|
|
488
486
|
See the [documentation on Threat Protection](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-threat-protection.html)
|
|
489
487
|
|
|
488
|
+
**Note**: Threat Protection requires the PLUS feature plan for new user pools. CDK allows you to configure threat protection settings at synthesis time, and CloudFormation will validate feature plan requirements at deployment time. Existing user pools that are grandfathered on LITE plans with threat protection enabled will continue to work.
|
|
489
|
+
|
|
490
490
|
|
|
491
491
|
### Emails
|
|
492
492
|
|
|
@@ -1907,7 +1907,7 @@ You can configure [tag propagation on volume creation](https://docs.aws.amazon.c
|
|
|
1907
1907
|
|
|
1908
1908
|
#### Throughput on GP3 Volumes
|
|
1909
1909
|
|
|
1910
|
-
You can specify the `throughput` of a GP3 volume from 125 (default) to
|
|
1910
|
+
You can specify the `throughput` of a GP3 volume from 125 (default) to 2000.
|
|
1911
1911
|
|
|
1912
1912
|
```ts
|
|
1913
1913
|
new ec2.Volume(this, 'Volume', {
|
|
@@ -248,7 +248,7 @@ repository.addToResourcePolicy(new iam.PolicyStatement({
|
|
|
248
248
|
}));
|
|
249
249
|
```
|
|
250
250
|
|
|
251
|
-
##
|
|
251
|
+
## Import existing repository
|
|
252
252
|
|
|
253
253
|
You can import an existing repository into your CDK app using the `Repository.fromRepositoryArn`, `Repository.fromRepositoryName` or `Repository.fromLookup` method.
|
|
254
254
|
These methods take the ARN or the name of the repository and returns an `IRepository` object.
|
|
@@ -1661,9 +1661,9 @@ new ecs.Ec2Service(this, 'EC2Service', {
|
|
|
1661
1661
|
|
|
1662
1662
|
### Managed Instances Capacity Providers
|
|
1663
1663
|
|
|
1664
|
-
Managed Instances Capacity Providers allow you to use AWS-managed EC2 instances for your ECS tasks while providing more control over instance selection than standard Fargate. AWS handles the instance lifecycle, patching, and maintenance while you can specify detailed instance requirements.
|
|
1664
|
+
Managed Instances Capacity Providers allow you to use AWS-managed EC2 instances for your ECS tasks while providing more control over instance selection than standard Fargate. AWS handles the instance lifecycle, patching, and maintenance while you can specify detailed instance requirements. You can define detailed instance requirements to control which types of instances are used for your workloads.
|
|
1665
1665
|
|
|
1666
|
-
|
|
1666
|
+
See [ECS documentation for Managed Instances Capacity Provider](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/managed-instances-capacity-providers-concept.html) for more documentation.
|
|
1667
1667
|
|
|
1668
1668
|
```ts
|
|
1669
1669
|
declare const vpc: ec2.Vpc;
|
|
@@ -1693,14 +1693,19 @@ miCapacityProvider.connections.allowFrom(ec2.Peer.ipv4(vpc.vpcCidrBlock), ec2.Po
|
|
|
1693
1693
|
// Add the capacity provider to the cluster
|
|
1694
1694
|
cluster.addManagedInstancesCapacityProvider(miCapacityProvider);
|
|
1695
1695
|
|
|
1696
|
-
const taskDefinition = new ecs.
|
|
1696
|
+
const taskDefinition = new ecs.TaskDefinition(this, 'TaskDef', {
|
|
1697
|
+
memoryMiB: '512',
|
|
1698
|
+
cpu: '256',
|
|
1699
|
+
networkMode: ecs.NetworkMode.AWS_VPC,
|
|
1700
|
+
compatibility: ecs.Compatibility.MANAGED_INSTANCES,
|
|
1701
|
+
});
|
|
1697
1702
|
|
|
1698
1703
|
taskDefinition.addContainer('web', {
|
|
1699
1704
|
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
|
|
1700
1705
|
memoryReservationMiB: 256,
|
|
1701
1706
|
});
|
|
1702
1707
|
|
|
1703
|
-
new ecs.
|
|
1708
|
+
new ecs.FargateService(this, 'FargateService', {
|
|
1704
1709
|
cluster,
|
|
1705
1710
|
taskDefinition,
|
|
1706
1711
|
minHealthyPercent: 100,
|
|
@@ -1761,6 +1766,41 @@ const miCapacityProvider = new ecs.ManagedInstancesCapacityProvider(this, 'MICap
|
|
|
1761
1766
|
onDemandMaxPricePercentageOverLowestPrice: 10,
|
|
1762
1767
|
},
|
|
1763
1768
|
});
|
|
1769
|
+
|
|
1770
|
+
```
|
|
1771
|
+
#### Note: Service Replacement When Migrating from LaunchType to CapacityProviderStrategy
|
|
1772
|
+
|
|
1773
|
+
**Understanding the Limitation**
|
|
1774
|
+
|
|
1775
|
+
The ECS [CreateService API](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_CreateService.html#ECS-CreateService-request-launchType) does not allow specifying both `launchType` and `capacityProviderStrategies` simultaneously. When you specify `capacityProviderStrategies`, the CDK uses those capacity providers instead of a launch type. This is a limitation of the ECS API and CloudFormation, not a CDK bug.
|
|
1776
|
+
|
|
1777
|
+
**Impact on Updates**
|
|
1778
|
+
|
|
1779
|
+
Because `launchType` is immutable during updates, switching from `launchType` to `capacityProviderStrategies` requires CloudFormation to replace the service. This means your existing service will be deleted and recreated with the new configuration. This behavior is expected and reflects the underlying API constraints.
|
|
1780
|
+
|
|
1781
|
+
**Workaround**
|
|
1782
|
+
|
|
1783
|
+
While we work on a long-term solution, you can use the following [escape hatch](https://docs.aws.amazon.com/cdk/v2/guide/cfn-layer.html) to preserve your service during the migration:
|
|
1784
|
+
|
|
1785
|
+
```ts
|
|
1786
|
+
declare const cluster: ecs.Cluster;
|
|
1787
|
+
declare const taskDefinition: ecs.TaskDefinition;
|
|
1788
|
+
declare const miCapacityProvider: ecs.ManagedInstancesCapacityProvider;
|
|
1789
|
+
|
|
1790
|
+
const service = new ecs.FargateService(this, 'Service', {
|
|
1791
|
+
cluster,
|
|
1792
|
+
taskDefinition,
|
|
1793
|
+
capacityProviderStrategies: [
|
|
1794
|
+
{
|
|
1795
|
+
capacityProvider: miCapacityProvider.capacityProviderName,
|
|
1796
|
+
weight: 1,
|
|
1797
|
+
},
|
|
1798
|
+
],
|
|
1799
|
+
});
|
|
1800
|
+
|
|
1801
|
+
// Escape hatch: Force launchType at the CloudFormation level to prevent service replacement
|
|
1802
|
+
const cfnService = service.node.defaultChild as ecs.CfnService;
|
|
1803
|
+
cfnService.launchType = 'FARGATE'; // or 'FARGATE_SPOT' depending on your capacity provider
|
|
1764
1804
|
```
|
|
1765
1805
|
|
|
1766
1806
|
### Cluster Default Provider Strategy
|
|
@@ -7,7 +7,7 @@ class TestStack extends Stack {
|
|
|
7
7
|
constructor(scope: Construct, id: string, props?: StackProps) {
|
|
8
8
|
super(scope, id, props);
|
|
9
9
|
|
|
10
|
-
const instanceTypes = ['i4g.large.search', 'i4i.xlarge.search', 'r7gd.xlarge.search'];
|
|
10
|
+
const instanceTypes = ['i4g.large.search', 'i4i.xlarge.search', 'r7gd.xlarge.search', 'r8gd.medium.search'];
|
|
11
11
|
|
|
12
12
|
instanceTypes.forEach((instanceType, index) => {
|
|
13
13
|
new opensearch.Domain(this, `Domain${index + 1}`, {
|
|
@@ -1204,7 +1204,7 @@ const cluster = new rds.DatabaseCluster(this, 'Database', {
|
|
|
1204
1204
|
}),
|
|
1205
1205
|
writer: rds.ClusterInstance.provisioned('writer'),
|
|
1206
1206
|
vpc,
|
|
1207
|
-
cloudwatchLogsExports: ['error', 'general', 'slowquery', 'audit'], // Export all available MySQL-based logs
|
|
1207
|
+
cloudwatchLogsExports: ['error', 'general', 'slowquery', 'audit', 'instance', 'iam-db-auth-error'], // Export all available MySQL-based logs
|
|
1208
1208
|
cloudwatchLogsRetention: logs.RetentionDays.THREE_MONTHS, // Optional - default is to never expire logs
|
|
1209
1209
|
cloudwatchLogsRetentionRole: myLogsPublishingRole, // Optional - a role will be created if not provided
|
|
1210
1210
|
// ...
|