konokenj.cdk-api-mcp-server 0.56.0__py3-none-any.whl → 0.58.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.
- cdk_api_mcp_server/__about__.py +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-bedrock-agentcore-alpha/README.md +119 -15
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-imagebuilder-alpha/README.md +603 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/mixins-preview/README.md +9 -7
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-appconfig/integ.configuration-kms.ts +2 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-appconfig/integ.configuration.ts +3 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-appmesh/README.md +4 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codecommit/integ.codecommit-code-asset-zip.ts +2 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codecommit/integ.codecommit-code-asset.ts +2 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/README.md +46 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/TABLE_V1_API.md +45 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb.compound.ts +32 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.table-v2.compound.ts +43 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/integ.alb.oidc.ts +2 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2-actions/integ.cognito.ts +2 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/README.md +30 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.lambda-snapstart.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.lambda-sourceKMSKeyArn.ts +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.multi-tenancy.ts +24 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.runtimes.ts +2 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-servicecatalog/integ.nested-stack-in-product-stack.ts +3 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-servicecatalog/integ.product.encrypted.asset.ts +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-servicecatalog/integ.product.ts +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cloudformation-include/integ.autoscaling-update-policy.ts +2 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cloudformation-include/integ.intrinsic-deletion-policy.ts +2 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cloudformation-include/integ.nested-stacks.ts +3 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cloudformation-include/integ.resource-tags-wtih-intrinsics.ts +2 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/triggers/integ.triggers.ts +2 -1
- {konokenj_cdk_api_mcp_server-0.56.0.dist-info → konokenj_cdk_api_mcp_server-0.58.0.dist-info}/METADATA +2 -2
- {konokenj_cdk_api_mcp_server-0.56.0.dist-info → konokenj_cdk_api_mcp_server-0.58.0.dist-info}/RECORD +33 -30
- {konokenj_cdk_api_mcp_server-0.56.0.dist-info → konokenj_cdk_api_mcp_server-0.58.0.dist-info}/WHEEL +0 -0
- {konokenj_cdk_api_mcp_server-0.56.0.dist-info → konokenj_cdk_api_mcp_server-0.58.0.dist-info}/entry_points.txt +0 -0
- {konokenj_cdk_api_mcp_server-0.56.0.dist-info → konokenj_cdk_api_mcp_server-0.58.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -36,6 +36,377 @@ 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
|
+
### Image Recipe
|
|
40
|
+
|
|
41
|
+
#### Image Recipe Basic Usage
|
|
42
|
+
|
|
43
|
+
Create an image recipe with the required base image:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
const imageRecipe = new imagebuilder.ImageRecipe(this, 'MyImageRecipe', {
|
|
47
|
+
baseImage: imagebuilder.BaseImage.fromSsmParameterName(
|
|
48
|
+
'/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64'
|
|
49
|
+
)
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### Image Recipe Base Images
|
|
54
|
+
|
|
55
|
+
To create a recipe, you have to select a base image to build and customize from. This base image can be referenced from
|
|
56
|
+
various sources, such as from SSM parameters, AWS Marketplace products, and AMI IDs directly.
|
|
57
|
+
|
|
58
|
+
##### SSM Parameters
|
|
59
|
+
|
|
60
|
+
Using SSM parameter references:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
const imageRecipe = new imagebuilder.ImageRecipe(this, 'SsmImageRecipe', {
|
|
64
|
+
baseImage: imagebuilder.BaseImage.fromSsmParameterName(
|
|
65
|
+
'/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64'
|
|
66
|
+
)
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// Using an SSM parameter construct
|
|
70
|
+
const parameter = ssm.StringParameter.fromStringParameterName(
|
|
71
|
+
this,
|
|
72
|
+
'BaseImageParameter',
|
|
73
|
+
'/aws/service/ami-windows-latest/Windows_Server-2022-English-Full-Base'
|
|
74
|
+
);
|
|
75
|
+
const windowsRecipe = new imagebuilder.ImageRecipe(this, 'WindowsImageRecipe', {
|
|
76
|
+
baseImage: imagebuilder.BaseImage.fromSsmParameter(parameter)
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
##### AMI IDs
|
|
81
|
+
|
|
82
|
+
When you have a specific AMI to use:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
const imageRecipe = new imagebuilder.ImageRecipe(this, 'AmiImageRecipe', {
|
|
86
|
+
baseImage: imagebuilder.BaseImage.fromAmiId('ami-12345678')
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
##### Marketplace Images
|
|
91
|
+
|
|
92
|
+
For marketplace base images:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
const imageRecipe = new imagebuilder.ImageRecipe(this, 'MarketplaceImageRecipe', {
|
|
96
|
+
baseImage: imagebuilder.BaseImage.fromMarketplaceProductId('prod-1234567890abcdef0')
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### Image Recipe Components
|
|
101
|
+
|
|
102
|
+
Components from various sources, such as custom-owned, AWS-owned, or AWS Marketplace-owned, can optionally be included
|
|
103
|
+
in recipes. For parameterized components, you are able to provide the parameters to use in the recipe, which will be
|
|
104
|
+
applied during the image build when executing components.
|
|
105
|
+
|
|
106
|
+
##### Custom Components in Image Recipes
|
|
107
|
+
|
|
108
|
+
Add your own components to the recipe:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
const customComponent = new imagebuilder.Component(this, 'MyComponent', {
|
|
112
|
+
platform: imagebuilder.Platform.LINUX,
|
|
113
|
+
data: imagebuilder.ComponentData.fromJsonObject({
|
|
114
|
+
schemaVersion: imagebuilder.ComponentSchemaVersion.V1_0,
|
|
115
|
+
phases: [
|
|
116
|
+
{
|
|
117
|
+
name: imagebuilder.ComponentPhaseName.BUILD,
|
|
118
|
+
steps: [
|
|
119
|
+
{
|
|
120
|
+
name: 'install-app',
|
|
121
|
+
action: imagebuilder.ComponentAction.EXECUTE_BASH,
|
|
122
|
+
inputs: {
|
|
123
|
+
commands: ['yum install -y my-application']
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const imageRecipe = new imagebuilder.ImageRecipe(this, 'ComponentImageRecipe', {
|
|
133
|
+
baseImage: imagebuilder.BaseImage.fromSsmParameterName(
|
|
134
|
+
'/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64'
|
|
135
|
+
),
|
|
136
|
+
components: [
|
|
137
|
+
{
|
|
138
|
+
component: customComponent
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
##### AWS-Managed Components in Image Recipes
|
|
145
|
+
|
|
146
|
+
Use pre-built AWS components:
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
const imageRecipe = new imagebuilder.ImageRecipe(this, 'AwsManagedImageRecipe', {
|
|
150
|
+
baseImage: imagebuilder.BaseImage.fromSsmParameterName(
|
|
151
|
+
'/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64'
|
|
152
|
+
),
|
|
153
|
+
components: [
|
|
154
|
+
{
|
|
155
|
+
component: imagebuilder.AwsManagedComponent.updateOS(this, 'UpdateOS', {
|
|
156
|
+
platform: imagebuilder.Platform.LINUX
|
|
157
|
+
})
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
component: imagebuilder.AwsManagedComponent.awsCliV2(this, 'AwsCli', {
|
|
161
|
+
platform: imagebuilder.Platform.LINUX
|
|
162
|
+
})
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
##### Component Parameters in Image Recipes
|
|
169
|
+
|
|
170
|
+
Pass parameters to components that accept them:
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
const parameterizedComponent = imagebuilder.Component.fromComponentName(
|
|
174
|
+
this,
|
|
175
|
+
'ParameterizedComponent',
|
|
176
|
+
'my-parameterized-component'
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
const imageRecipe = new imagebuilder.ImageRecipe(this, 'ParameterizedImageRecipe', {
|
|
180
|
+
baseImage: imagebuilder.BaseImage.fromSsmParameterName(
|
|
181
|
+
'/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64'
|
|
182
|
+
),
|
|
183
|
+
components: [
|
|
184
|
+
{
|
|
185
|
+
component: parameterizedComponent,
|
|
186
|
+
parameters: {
|
|
187
|
+
environment: imagebuilder.ComponentParameterValue.fromString('production'),
|
|
188
|
+
version: imagebuilder.ComponentParameterValue.fromString('1.0.0')
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
});
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
#### Image Recipe Configuration
|
|
196
|
+
|
|
197
|
+
##### Block Device Configuration
|
|
198
|
+
|
|
199
|
+
Configure storage for the build instance:
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
const imageRecipe = new imagebuilder.ImageRecipe(this, 'BlockDeviceImageRecipe', {
|
|
203
|
+
baseImage: imagebuilder.BaseImage.fromSsmParameterName(
|
|
204
|
+
'/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64'
|
|
205
|
+
),
|
|
206
|
+
blockDevices: [
|
|
207
|
+
{
|
|
208
|
+
deviceName: '/dev/sda1',
|
|
209
|
+
volume: ec2.BlockDeviceVolume.ebs(100, {
|
|
210
|
+
encrypted: true,
|
|
211
|
+
volumeType: ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
##### AMI Tagging
|
|
219
|
+
|
|
220
|
+
Tag the output AMI:
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
const imageRecipe = new imagebuilder.ImageRecipe(this, 'TaggedImageRecipe', {
|
|
224
|
+
baseImage: imagebuilder.BaseImage.fromSsmParameterName(
|
|
225
|
+
'/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64'
|
|
226
|
+
),
|
|
227
|
+
amiTags: {
|
|
228
|
+
Environment: 'Production',
|
|
229
|
+
Application: 'WebServer',
|
|
230
|
+
Owner: 'DevOps Team'
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Container Recipe
|
|
236
|
+
|
|
237
|
+
A container recipe is similar to an image recipe but specifically for container images. It defines the base container
|
|
238
|
+
image and components applied to produce the desired configuration for the output container image. Container recipes work
|
|
239
|
+
with Docker images from DockerHub, Amazon ECR, or Amazon-managed container images as starting points.
|
|
240
|
+
|
|
241
|
+
#### Container Recipe Basic Usage
|
|
242
|
+
|
|
243
|
+
Create a container recipe with the required base image and target repository:
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
const containerRecipe = new imagebuilder.ContainerRecipe(this, 'MyContainerRecipe', {
|
|
247
|
+
baseImage: imagebuilder.BaseContainerImage.fromDockerHub('amazonlinux', 'latest'),
|
|
248
|
+
targetRepository: imagebuilder.Repository.fromEcr(
|
|
249
|
+
ecr.Repository.fromRepositoryName(this, 'Repository', 'my-container-repo')
|
|
250
|
+
)
|
|
251
|
+
});
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
#### Container Recipe Base Images
|
|
255
|
+
|
|
256
|
+
##### DockerHub Images
|
|
257
|
+
|
|
258
|
+
Using public Docker Hub images:
|
|
259
|
+
|
|
260
|
+
```ts
|
|
261
|
+
const containerRecipe = new imagebuilder.ContainerRecipe(this, 'DockerHubContainerRecipe', {
|
|
262
|
+
baseImage: imagebuilder.BaseContainerImage.fromDockerHub('amazonlinux', 'latest'),
|
|
263
|
+
targetRepository: imagebuilder.Repository.fromEcr(
|
|
264
|
+
ecr.Repository.fromRepositoryName(this, 'Repository', 'my-container-repo')
|
|
265
|
+
)
|
|
266
|
+
});
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
##### ECR Images
|
|
270
|
+
|
|
271
|
+
Using images from your own ECR repositories:
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
const sourceRepo = ecr.Repository.fromRepositoryName(this, 'SourceRepo', 'my-base-image');
|
|
275
|
+
const targetRepo = ecr.Repository.fromRepositoryName(this, 'TargetRepo', 'my-container-repo');
|
|
276
|
+
|
|
277
|
+
const containerRecipe = new imagebuilder.ContainerRecipe(this, 'EcrContainerRecipe', {
|
|
278
|
+
baseImage: imagebuilder.BaseContainerImage.fromEcr(sourceRepo, '1.0.0'),
|
|
279
|
+
targetRepository: imagebuilder.Repository.fromEcr(targetRepo)
|
|
280
|
+
});
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
##### ECR Public Images
|
|
284
|
+
|
|
285
|
+
Using images from Amazon ECR Public:
|
|
286
|
+
|
|
287
|
+
```ts
|
|
288
|
+
const containerRecipe = new imagebuilder.ContainerRecipe(this, 'EcrPublicContainerRecipe', {
|
|
289
|
+
baseImage: imagebuilder.BaseContainerImage.fromEcrPublic('amazonlinux', 'amazonlinux', '2023'),
|
|
290
|
+
targetRepository: imagebuilder.Repository.fromEcr(
|
|
291
|
+
ecr.Repository.fromRepositoryName(this, 'Repository', 'my-container-repo')
|
|
292
|
+
)
|
|
293
|
+
});
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
#### Container Recipe Components
|
|
297
|
+
|
|
298
|
+
##### Custom Components in Container Recipes
|
|
299
|
+
|
|
300
|
+
Add your own components to the container recipe:
|
|
301
|
+
|
|
302
|
+
```ts
|
|
303
|
+
const customComponent = new imagebuilder.Component(this, 'MyComponent', {
|
|
304
|
+
platform: imagebuilder.Platform.LINUX,
|
|
305
|
+
data: imagebuilder.ComponentData.fromJsonObject({
|
|
306
|
+
schemaVersion: imagebuilder.ComponentSchemaVersion.V1_0,
|
|
307
|
+
phases: [
|
|
308
|
+
{
|
|
309
|
+
name: imagebuilder.ComponentPhaseName.BUILD,
|
|
310
|
+
steps: [
|
|
311
|
+
{
|
|
312
|
+
name: 'install-app',
|
|
313
|
+
action: imagebuilder.ComponentAction.EXECUTE_BASH,
|
|
314
|
+
inputs: {
|
|
315
|
+
commands: ['yum install -y my-container-application']
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
]
|
|
321
|
+
})
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
const containerRecipe = new imagebuilder.ContainerRecipe(this, 'ComponentContainerRecipe', {
|
|
325
|
+
baseImage: imagebuilder.BaseContainerImage.fromDockerHub('amazonlinux', 'latest'),
|
|
326
|
+
targetRepository: imagebuilder.Repository.fromEcr(
|
|
327
|
+
ecr.Repository.fromRepositoryName(this, 'Repository', 'my-container-repo')
|
|
328
|
+
),
|
|
329
|
+
components: [
|
|
330
|
+
{
|
|
331
|
+
component: customComponent
|
|
332
|
+
}
|
|
333
|
+
]
|
|
334
|
+
});
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
##### AWS-Managed Components in Container Recipes
|
|
338
|
+
|
|
339
|
+
Use pre-built AWS components:
|
|
340
|
+
|
|
341
|
+
```ts
|
|
342
|
+
const containerRecipe = new imagebuilder.ContainerRecipe(this, 'AwsManagedContainerRecipe', {
|
|
343
|
+
baseImage: imagebuilder.BaseContainerImage.fromDockerHub('amazonlinux', 'latest'),
|
|
344
|
+
targetRepository: imagebuilder.Repository.fromEcr(
|
|
345
|
+
ecr.Repository.fromRepositoryName(this, 'Repository', 'my-container-repo')
|
|
346
|
+
),
|
|
347
|
+
components: [
|
|
348
|
+
{
|
|
349
|
+
component: imagebuilder.AwsManagedComponent.updateOS(this, 'UpdateOS', {
|
|
350
|
+
platform: imagebuilder.Platform.LINUX
|
|
351
|
+
})
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
component: imagebuilder.AwsManagedComponent.awsCliV2(this, 'AwsCli', {
|
|
355
|
+
platform: imagebuilder.Platform.LINUX
|
|
356
|
+
})
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
});
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
#### Container Recipe Configuration
|
|
363
|
+
|
|
364
|
+
##### Custom Dockerfile
|
|
365
|
+
|
|
366
|
+
Provide your own Dockerfile template:
|
|
367
|
+
|
|
368
|
+
```ts
|
|
369
|
+
const containerRecipe = new imagebuilder.ContainerRecipe(this, 'CustomDockerfileContainerRecipe', {
|
|
370
|
+
baseImage: imagebuilder.BaseContainerImage.fromDockerHub('amazonlinux', 'latest'),
|
|
371
|
+
targetRepository: imagebuilder.Repository.fromEcr(
|
|
372
|
+
ecr.Repository.fromRepositoryName(this, 'Repository', 'my-container-repo')
|
|
373
|
+
),
|
|
374
|
+
dockerfile: imagebuilder.DockerfileData.fromInline(`
|
|
375
|
+
FROM {{{ imagebuilder:parentImage }}}
|
|
376
|
+
CMD ["echo", "Hello, world!"]
|
|
377
|
+
{{{ imagebuilder:environments }}}
|
|
378
|
+
{{{ imagebuilder:components }}}
|
|
379
|
+
`)
|
|
380
|
+
});
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
##### Instance Configuration
|
|
384
|
+
|
|
385
|
+
Configure the build instance:
|
|
386
|
+
|
|
387
|
+
```ts
|
|
388
|
+
const containerRecipe = new imagebuilder.ContainerRecipe(this, 'InstanceConfigContainerRecipe', {
|
|
389
|
+
baseImage: imagebuilder.BaseContainerImage.fromDockerHub('amazonlinux', 'latest'),
|
|
390
|
+
targetRepository: imagebuilder.Repository.fromEcr(
|
|
391
|
+
ecr.Repository.fromRepositoryName(this, 'Repository', 'my-container-repo')
|
|
392
|
+
),
|
|
393
|
+
// Custom ECS-optimized AMI for building
|
|
394
|
+
instanceImage: imagebuilder.ContainerInstanceImage.fromSsmParameterName(
|
|
395
|
+
'/aws/service/ecs/optimized-ami/amazon-linux-2023/recommended/image_id'
|
|
396
|
+
),
|
|
397
|
+
// Additional storage for build process
|
|
398
|
+
instanceBlockDevices: [
|
|
399
|
+
{
|
|
400
|
+
deviceName: '/dev/xvda',
|
|
401
|
+
volume: ec2.BlockDeviceVolume.ebs(50, {
|
|
402
|
+
encrypted: true,
|
|
403
|
+
volumeType: ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3
|
|
404
|
+
})
|
|
405
|
+
}
|
|
406
|
+
]
|
|
407
|
+
});
|
|
408
|
+
```
|
|
409
|
+
|
|
39
410
|
### Component
|
|
40
411
|
|
|
41
412
|
A component defines the sequence of steps required to customize an instance during image creation (build component) or
|
|
@@ -47,7 +418,7 @@ EC2 Image Builder supports AWS-managed components for common tasks, AWS Marketpl
|
|
|
47
418
|
that you create. Components run during specific workflow phases: build and validate phases during the build stage, and
|
|
48
419
|
test phase during the test stage.
|
|
49
420
|
|
|
50
|
-
#### Basic Usage
|
|
421
|
+
#### Basic Component Usage
|
|
51
422
|
|
|
52
423
|
Create a component with the required properties: platform and component data.
|
|
53
424
|
|
|
@@ -232,13 +603,13 @@ const component = new imagebuilder.Component(this, 'EncryptedComponent', {
|
|
|
232
603
|
name: 'secure-setup',
|
|
233
604
|
action: imagebuilder.ComponentAction.EXECUTE_BASH,
|
|
234
605
|
inputs: {
|
|
235
|
-
commands: ['echo "This component data is encrypted with KMS"']
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
]
|
|
239
|
-
}
|
|
240
|
-
]
|
|
241
|
-
})
|
|
606
|
+
commands: ['echo "This component data is encrypted with KMS"']
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
]
|
|
610
|
+
}
|
|
611
|
+
]
|
|
612
|
+
})
|
|
242
613
|
});
|
|
243
614
|
```
|
|
244
615
|
|
|
@@ -479,3 +850,227 @@ containerDistributionConfiguration.addContainerDistributions({
|
|
|
479
850
|
containerTags: ['latest', 'latest-1.0']
|
|
480
851
|
});
|
|
481
852
|
```
|
|
853
|
+
|
|
854
|
+
### Workflow
|
|
855
|
+
|
|
856
|
+
Workflows define the sequence of steps that Image Builder performs during image creation. There are three workflow types: BUILD (image building), TEST (testing images), and DISTRIBUTION (distributing container images).
|
|
857
|
+
|
|
858
|
+
#### Basic Workflow Usage
|
|
859
|
+
|
|
860
|
+
Create a workflow with the required properties: workflow type and workflow data.
|
|
861
|
+
|
|
862
|
+
```ts
|
|
863
|
+
const workflow = new imagebuilder.Workflow(this, 'MyWorkflow', {
|
|
864
|
+
workflowType: imagebuilder.WorkflowType.BUILD,
|
|
865
|
+
data: imagebuilder.WorkflowData.fromJsonObject({
|
|
866
|
+
schemaVersion: imagebuilder.WorkflowSchemaVersion.V1_0,
|
|
867
|
+
steps: [
|
|
868
|
+
{
|
|
869
|
+
name: 'LaunchBuildInstance',
|
|
870
|
+
action: imagebuilder.WorkflowAction.LAUNCH_INSTANCE,
|
|
871
|
+
onFailure: imagebuilder.WorkflowOnFailure.ABORT,
|
|
872
|
+
inputs: {
|
|
873
|
+
waitFor: 'ssmAgent',
|
|
874
|
+
},
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
name: 'ExecuteComponents',
|
|
878
|
+
action: imagebuilder.WorkflowAction.EXECUTE_COMPONENTS,
|
|
879
|
+
onFailure: imagebuilder.WorkflowOnFailure.ABORT,
|
|
880
|
+
inputs: {
|
|
881
|
+
'instanceId': 'i-123',
|
|
882
|
+
},
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
name: 'CreateImage',
|
|
886
|
+
action: imagebuilder.WorkflowAction.CREATE_IMAGE,
|
|
887
|
+
onFailure: imagebuilder.WorkflowOnFailure.ABORT,
|
|
888
|
+
inputs: {
|
|
889
|
+
'instanceId': 'i-123',
|
|
890
|
+
},
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
name: 'TerminateInstance',
|
|
894
|
+
action: imagebuilder.WorkflowAction.TERMINATE_INSTANCE,
|
|
895
|
+
onFailure: imagebuilder.WorkflowOnFailure.CONTINUE,
|
|
896
|
+
inputs: {
|
|
897
|
+
'instanceId': 'i-123',
|
|
898
|
+
},
|
|
899
|
+
},
|
|
900
|
+
],
|
|
901
|
+
outputs: [
|
|
902
|
+
{
|
|
903
|
+
name: 'ImageId',
|
|
904
|
+
value: '$.stepOutputs.CreateImage.imageId',
|
|
905
|
+
},
|
|
906
|
+
],
|
|
907
|
+
}),
|
|
908
|
+
});
|
|
909
|
+
```
|
|
910
|
+
|
|
911
|
+
#### Workflow Data Sources
|
|
912
|
+
|
|
913
|
+
##### Inline Workflow Data
|
|
914
|
+
|
|
915
|
+
Use `WorkflowData.fromInline()` for existing YAML/JSON definitions:
|
|
916
|
+
|
|
917
|
+
```ts
|
|
918
|
+
const workflow = new imagebuilder.Workflow(this, 'InlineWorkflow', {
|
|
919
|
+
workflowType: imagebuilder.WorkflowType.TEST,
|
|
920
|
+
data: imagebuilder.WorkflowData.fromInline(`
|
|
921
|
+
schemaVersion: 1.0
|
|
922
|
+
steps:
|
|
923
|
+
- name: LaunchTestInstance
|
|
924
|
+
action: LaunchInstance
|
|
925
|
+
onFailure: Abort
|
|
926
|
+
inputs:
|
|
927
|
+
waitFor: ssmAgent
|
|
928
|
+
- name: RunTests
|
|
929
|
+
action: RunCommand
|
|
930
|
+
onFailure: Abort
|
|
931
|
+
inputs:
|
|
932
|
+
instanceId.$: "$.stepOutputs.LaunchTestInstance.instanceId"
|
|
933
|
+
commands: ['./run-tests.sh']
|
|
934
|
+
- name: TerminateTestInstance
|
|
935
|
+
action: TerminateInstance
|
|
936
|
+
onFailure: Continue
|
|
937
|
+
inputs:
|
|
938
|
+
instanceId.$: "$.stepOutputs.LaunchTestInstance.instanceId"
|
|
939
|
+
`),
|
|
940
|
+
});
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
##### JSON Object Workflow Data
|
|
944
|
+
|
|
945
|
+
Most developer-friendly approach using JavaScript objects:
|
|
946
|
+
|
|
947
|
+
```ts
|
|
948
|
+
const workflow = new imagebuilder.Workflow(this, 'JsonWorkflow', {
|
|
949
|
+
workflowType: imagebuilder.WorkflowType.BUILD,
|
|
950
|
+
data: imagebuilder.WorkflowData.fromJsonObject({
|
|
951
|
+
schemaVersion: imagebuilder.WorkflowSchemaVersion.V1_0,
|
|
952
|
+
steps: [
|
|
953
|
+
{
|
|
954
|
+
name: 'LaunchBuildInstance',
|
|
955
|
+
action: imagebuilder.WorkflowAction.LAUNCH_INSTANCE,
|
|
956
|
+
onFailure: imagebuilder.WorkflowOnFailure.ABORT,
|
|
957
|
+
inputs: {
|
|
958
|
+
waitFor: 'ssmAgent'
|
|
959
|
+
}
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
name: 'ExecuteComponents',
|
|
963
|
+
action: imagebuilder.WorkflowAction.EXECUTE_COMPONENTS,
|
|
964
|
+
onFailure: imagebuilder.WorkflowOnFailure.ABORT,
|
|
965
|
+
inputs: {
|
|
966
|
+
'instanceId': 'i-123'
|
|
967
|
+
}
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
name: 'CreateImage',
|
|
971
|
+
action: imagebuilder.WorkflowAction.CREATE_IMAGE,
|
|
972
|
+
onFailure: imagebuilder.WorkflowOnFailure.ABORT,
|
|
973
|
+
inputs: {
|
|
974
|
+
'instanceId': 'i-123'
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
name: 'TerminateInstance',
|
|
979
|
+
action: imagebuilder.WorkflowAction.TERMINATE_INSTANCE,
|
|
980
|
+
onFailure: imagebuilder.WorkflowOnFailure.CONTINUE,
|
|
981
|
+
inputs: {
|
|
982
|
+
'instanceId': 'i-123'
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
],
|
|
986
|
+
outputs: [
|
|
987
|
+
{
|
|
988
|
+
name: 'ImageId',
|
|
989
|
+
value: '$.stepOutputs.CreateImage.imageId'
|
|
990
|
+
}
|
|
991
|
+
]
|
|
992
|
+
})
|
|
993
|
+
});
|
|
994
|
+
```
|
|
995
|
+
|
|
996
|
+
##### S3 Workflow Data
|
|
997
|
+
|
|
998
|
+
For those workflows you want to upload or have uploaded to S3:
|
|
999
|
+
|
|
1000
|
+
```ts
|
|
1001
|
+
// Upload a local file
|
|
1002
|
+
const workflowFromAsset = new imagebuilder.Workflow(this, 'AssetWorkflow', {
|
|
1003
|
+
workflowType: imagebuilder.WorkflowType.BUILD,
|
|
1004
|
+
data: imagebuilder.WorkflowData.fromAsset(this, 'WorkflowAsset', './my-workflow.yml'),
|
|
1005
|
+
});
|
|
1006
|
+
|
|
1007
|
+
// Reference an existing S3 object
|
|
1008
|
+
const bucket = s3.Bucket.fromBucketName(this, 'WorkflowBucket', 'my-workflows-bucket');
|
|
1009
|
+
const workflowFromS3 = new imagebuilder.Workflow(this, 'S3Workflow', {
|
|
1010
|
+
workflowType: imagebuilder.WorkflowType.BUILD,
|
|
1011
|
+
data: imagebuilder.WorkflowData.fromS3(bucket, 'workflows/my-workflow.yml'),
|
|
1012
|
+
});
|
|
1013
|
+
```
|
|
1014
|
+
|
|
1015
|
+
#### Encrypt workflow data with a KMS key
|
|
1016
|
+
|
|
1017
|
+
You can encrypt workflow data with a KMS key, so that only principals with access to decrypt with the key are able to access the workflow data.
|
|
1018
|
+
|
|
1019
|
+
```ts
|
|
1020
|
+
const workflow = new imagebuilder.Workflow(this, 'EncryptedWorkflow', {
|
|
1021
|
+
workflowType: imagebuilder.WorkflowType.BUILD,
|
|
1022
|
+
kmsKey: new kms.Key(this, 'WorkflowKey'),
|
|
1023
|
+
data: imagebuilder.WorkflowData.fromJsonObject({
|
|
1024
|
+
schemaVersion: imagebuilder.WorkflowSchemaVersion.V1_0,
|
|
1025
|
+
steps: [
|
|
1026
|
+
{
|
|
1027
|
+
name: 'LaunchBuildInstance',
|
|
1028
|
+
action: imagebuilder.WorkflowAction.LAUNCH_INSTANCE,
|
|
1029
|
+
onFailure: imagebuilder.WorkflowOnFailure.ABORT,
|
|
1030
|
+
inputs: {
|
|
1031
|
+
waitFor: 'ssmAgent',
|
|
1032
|
+
},
|
|
1033
|
+
},
|
|
1034
|
+
{
|
|
1035
|
+
name: 'CreateImage',
|
|
1036
|
+
action: imagebuilder.WorkflowAction.CREATE_IMAGE,
|
|
1037
|
+
onFailure: imagebuilder.WorkflowOnFailure.ABORT,
|
|
1038
|
+
inputs: {
|
|
1039
|
+
'instanceId': 'i-123',
|
|
1040
|
+
},
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
name: 'TerminateInstance',
|
|
1044
|
+
action: imagebuilder.WorkflowAction.TERMINATE_INSTANCE,
|
|
1045
|
+
onFailure: imagebuilder.WorkflowOnFailure.CONTINUE,
|
|
1046
|
+
inputs: {
|
|
1047
|
+
'instanceId': 'i-123',
|
|
1048
|
+
},
|
|
1049
|
+
},
|
|
1050
|
+
],
|
|
1051
|
+
outputs: [
|
|
1052
|
+
{
|
|
1053
|
+
name: 'ImageId',
|
|
1054
|
+
value: '$.stepOutputs.CreateImage.imageId',
|
|
1055
|
+
},
|
|
1056
|
+
],
|
|
1057
|
+
}),
|
|
1058
|
+
});
|
|
1059
|
+
```
|
|
1060
|
+
|
|
1061
|
+
#### AWS-Managed Workflows
|
|
1062
|
+
|
|
1063
|
+
AWS provides a collection of workflows for common scenarios:
|
|
1064
|
+
|
|
1065
|
+
```ts
|
|
1066
|
+
// Build workflows
|
|
1067
|
+
const buildImageWorkflow = imagebuilder.AwsManagedWorkflow.buildImage(this, 'BuildImage');
|
|
1068
|
+
const buildContainerWorkflow = imagebuilder.AwsManagedWorkflow.buildContainer(this, 'BuildContainer');
|
|
1069
|
+
|
|
1070
|
+
// Test workflows
|
|
1071
|
+
const testImageWorkflow = imagebuilder.AwsManagedWorkflow.testImage(this, 'TestImage');
|
|
1072
|
+
const testContainerWorkflow = imagebuilder.AwsManagedWorkflow.testContainer(this, 'TestContainer');
|
|
1073
|
+
|
|
1074
|
+
// Distribution workflows
|
|
1075
|
+
const distributeContainerWorkflow = imagebuilder.AwsManagedWorkflow.distributeContainer(this, 'DistributeContainer');
|
|
1076
|
+
```
|
|
@@ -55,11 +55,11 @@ The `.with()` method is available after importing `@aws-cdk/mixins-preview/with`
|
|
|
55
55
|
|
|
56
56
|
## Creating Custom Mixins
|
|
57
57
|
|
|
58
|
-
Mixins are simple classes that implement the `IMixin` interface:
|
|
58
|
+
Mixins are simple classes that implement the `IMixin` interface (usually by extending the abstract `Mixin` class:
|
|
59
59
|
|
|
60
60
|
```typescript
|
|
61
61
|
// Simple mixin that enables versioning
|
|
62
|
-
class CustomVersioningMixin implements IMixin {
|
|
62
|
+
class CustomVersioningMixin extends Mixin implements IMixin {
|
|
63
63
|
supports(construct: any): boolean {
|
|
64
64
|
return construct instanceof s3.CfnBucket;
|
|
65
65
|
}
|
|
@@ -131,7 +131,7 @@ For every CloudFormation resource, CDK Mixins automatically generates type-safe
|
|
|
131
131
|
|
|
132
132
|
```typescript
|
|
133
133
|
import '@aws-cdk/mixins-preview/with';
|
|
134
|
-
|
|
134
|
+
|
|
135
135
|
|
|
136
136
|
const bucket = new s3.Bucket(scope, "Bucket")
|
|
137
137
|
.with(new CfnBucketPropsMixin({
|
|
@@ -146,6 +146,8 @@ const bucket = new s3.Bucket(scope, "Bucket")
|
|
|
146
146
|
Property mixins support two merge strategies:
|
|
147
147
|
|
|
148
148
|
```typescript
|
|
149
|
+
declare const bucket: s3.CfnBucket;
|
|
150
|
+
|
|
149
151
|
// MERGE (default): Deep merges properties with existing values
|
|
150
152
|
Mixins.of(bucket).apply(new CfnBucketPropsMixin(
|
|
151
153
|
{ versioningConfiguration: { status: "Enabled" } },
|
|
@@ -155,16 +157,16 @@ Mixins.of(bucket).apply(new CfnBucketPropsMixin(
|
|
|
155
157
|
// OVERWRITE: Replaces existing property values
|
|
156
158
|
Mixins.of(bucket).apply(new CfnBucketPropsMixin(
|
|
157
159
|
{ versioningConfiguration: { status: "Enabled" } },
|
|
158
|
-
{ strategy: PropertyMergeStrategy.
|
|
160
|
+
{ strategy: PropertyMergeStrategy.OVERRIDE }
|
|
159
161
|
));
|
|
160
162
|
```
|
|
161
163
|
|
|
162
164
|
Property mixins are available for all AWS services:
|
|
163
165
|
|
|
164
166
|
```typescript
|
|
165
|
-
import {
|
|
166
|
-
import {
|
|
167
|
-
import {
|
|
167
|
+
import { CfnLogGroupPropsMixin } from '@aws-cdk/mixins-preview/aws_logs/mixins';
|
|
168
|
+
import { CfnFunctionPropsMixin } from '@aws-cdk/mixins-preview/aws_lambda/mixins';
|
|
169
|
+
import { CfnTablePropsMixin } from '@aws-cdk/mixins-preview/aws_dynamodb/mixins';
|
|
168
170
|
```
|
|
169
171
|
|
|
170
172
|
## Error Handling
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-appconfig/integ.configuration-kms.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
ConfigurationContent,
|
|
7
7
|
HostedConfiguration,
|
|
8
8
|
} from 'aws-cdk-lib/aws-appconfig';
|
|
9
|
+
import * as path from 'path';
|
|
9
10
|
|
|
10
11
|
const app = new App();
|
|
11
12
|
|
|
@@ -21,7 +22,7 @@ const appConfigApp = new Application(stack, 'MyAppConfig', {
|
|
|
21
22
|
|
|
22
23
|
new HostedConfiguration(stack, 'MyHostedConfigFromFile', {
|
|
23
24
|
application: appConfigApp,
|
|
24
|
-
content: ConfigurationContent.fromFile('config.json'),
|
|
25
|
+
content: ConfigurationContent.fromFile(path.join(__dirname, 'config.json')),
|
|
25
26
|
kmsKey,
|
|
26
27
|
});
|
|
27
28
|
|