konokenj.cdk-api-mcp-server 0.47.0__py3-none-any.whl → 0.48.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.
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2025-present Kenji Kono <konoken@amazon.co.jp>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.47.0"
4
+ __version__ = "0.48.0"
@@ -1059,7 +1059,7 @@ The properties passed to the level 2 constructs `AutoScalingGroup` and `Instance
1059
1059
  `aws-ec2` module abstract what is passed into the `CfnOption` properties `resourceSignal` and
1060
1060
  `autoScalingCreationPolicy`, but when using level 1 constructs you can specify these yourself.
1061
1061
 
1062
- The CfnWaitCondition resource from the `aws-cloudformation` module suppports the `resourceSignal`.
1062
+ The CfnWaitCondition resource from the `aws-cloudformation` module supports the `resourceSignal`.
1063
1063
  The format of the timeout is `PT#H#M#S`. In the example below AWS Cloudformation will wait for
1064
1064
  3 success signals to occur within 15 minutes before the status of the resource will be set to
1065
1065
  `CREATE_COMPLETE`.
@@ -577,6 +577,82 @@ const fleet = new codebuild.Fleet(this, 'MyFleet', {
577
577
  });
578
578
  ```
579
579
 
580
+ ### Custom instance types
581
+ You can use [specific EC2 instance
582
+ types](https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html#environment-reserved-capacity.instance-types)
583
+ for your fleet by setting the `computeType` to `CUSTOM_INSTANCE_TYPE`. This
584
+ allows you to specify the `instanceType` in `computeConfiguration`. Only certain
585
+ EC2 instance types are supported; see the linked documentation for details.
586
+
587
+ ```ts
588
+ import { Size } from 'aws-cdk-lib';
589
+
590
+ const fleet = new codebuild.Fleet(this, 'MyFleet', {
591
+ baseCapacity: 1,
592
+ computeType: codebuild.FleetComputeType.CUSTOM_INSTANCE_TYPE,
593
+ environmentType: codebuild.EnvironmentType.LINUX_CONTAINER,
594
+ computeConfiguration: {
595
+ instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MEDIUM),
596
+ // By default, 64 GiB of disk space is included. Any value optionally
597
+ // specified here is _incremental_ on top of the included disk space.
598
+ disk: Size.gibibytes(10),
599
+ },
600
+ });
601
+ ```
602
+
603
+ ### Fleet overflow behavior
604
+
605
+ When your builds exceed the capacity of your fleet, you can specify how CodeBuild should handle the overflow builds by setting the `overflowBehavior` property:
606
+
607
+ ```ts
608
+ const fleet = new codebuild.Fleet(this, 'Fleet', {
609
+ computeType: codebuild.FleetComputeType.MEDIUM,
610
+ environmentType: codebuild.EnvironmentType.LINUX_CONTAINER,
611
+ baseCapacity: 1,
612
+ overflowBehavior: codebuild.FleetOverflowBehavior.ON_DEMAND,
613
+ });
614
+ ```
615
+
616
+ The available overflow behaviors are:
617
+
618
+ - `QUEUE` (default): Overflow builds wait for existing fleet instances to become available
619
+ - `ON_DEMAND`: Overflow builds run on CodeBuild on-demand instances
620
+
621
+ Note: If you set overflow behavior to `ON_DEMAND` for a VPC-connected fleet, ensure your VPC settings allow access to public AWS services.
622
+
623
+ ### VPCs
624
+ The same considerations that apply to [Project
625
+ VPCs](#definition-of-vpc-configuration-in-codebuild-project) also apply to Fleet
626
+ VPCs. When using a Fleet in a CodeBuild Project, it is an error to configure a
627
+ VPC on the Project. Configure a VPC on the fleet instead.
628
+
629
+ ```ts
630
+ declare const loadBalancer: elbv2.ApplicationLoadBalancer;
631
+
632
+ const vpc = new ec2.Vpc(this, 'MyVPC');
633
+ const fleet = new codebuild.Fleet(this, 'MyProject', {
634
+ computeType: codebuild.FleetComputeType.MEDIUM,
635
+ environmentType: codebuild.EnvironmentType.LINUX_CONTAINER,
636
+ baseCapacity: 1,
637
+ vpc,
638
+ });
639
+
640
+ fleet.connections.allowTo(loadBalancer, ec2.Port.tcp(443));
641
+
642
+ const project = new codebuild.Project(this, 'MyProject', {
643
+ environment: {
644
+ fleet,
645
+ },
646
+ buildSpec: codebuild.BuildSpec.fromObject({
647
+ // ...
648
+ }),
649
+ // Trying to configure a project-level VPC is an error, because this project
650
+ // runs on the Fleet created above.
651
+ // vpc,
652
+ });
653
+ ```
654
+ >>>>>>> 39ec36ec6a (feat(codebuild): add custom instance type and VPC to Fleets)
655
+
580
656
  ## Logs
581
657
 
582
658
  CodeBuild lets you specify an S3 Bucket, CloudWatch Log Group or both to receive logs from your projects.
@@ -1,17 +1,55 @@
1
+ import * as ec2 from 'aws-cdk-lib/aws-ec2';
1
2
  import * as cdk from 'aws-cdk-lib';
2
3
  import * as integ from '@aws-cdk/integ-tests-alpha';
3
4
  import * as codebuild from 'aws-cdk-lib/aws-codebuild';
4
5
  import { Construct } from 'constructs';
5
6
 
6
- const configurations: codebuild.ComputeConfiguration[] = [
7
+ type StackConfiguration = {
8
+ computeConfiguration: codebuild.ComputeConfiguration;
9
+ vpcProps?: ec2.VpcProps;
10
+ subnetSelection?: ec2.SubnetSelection;
11
+ securityGroupProps?: Array<Omit<ec2.SecurityGroupProps, 'vpc'>>;
12
+ }
13
+ const configurations: Array<StackConfiguration> = [
14
+ {
15
+ computeConfiguration: {
16
+ machineType: codebuild.MachineType.GENERAL,
17
+ },
18
+ },
7
19
  {
8
- machineType: codebuild.MachineType.GENERAL,
20
+ computeConfiguration: {
21
+ machineType: codebuild.MachineType.GENERAL,
22
+ vCpu: 2,
23
+ memory: cdk.Size.gibibytes(4),
24
+ disk: cdk.Size.gibibytes(10),
25
+ },
9
26
  },
10
27
  {
11
- machineType: codebuild.MachineType.GENERAL,
12
- vCpu: 2,
13
- memory: cdk.Size.gibibytes(4),
14
- disk: cdk.Size.gibibytes(10),
28
+ computeConfiguration: {
29
+ machineType: codebuild.MachineType.GENERAL,
30
+ },
31
+ vpcProps: {
32
+ maxAzs: 1,
33
+ restrictDefaultSecurityGroup: false,
34
+ },
35
+ },
36
+ {
37
+ computeConfiguration: {
38
+ machineType: codebuild.MachineType.GENERAL,
39
+ },
40
+ vpcProps: {
41
+ maxAzs: 1,
42
+ // Incredibly, if you pass a SubnetSelection that produces more than 1
43
+ // subnet, you currently get this error:
44
+ // > Resource handler returned message: "Invalid vpc config: the maximum number of subnets is 1
45
+ // This seems like a terrible limitation from the CodeBuild team.
46
+ // maxAzs: 2,
47
+ },
48
+ subnetSelection: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS },
49
+ securityGroupProps: [
50
+ { allowAllOutbound: true },
51
+ { allowAllIpv6Outbound: true },
52
+ ],
15
53
  },
16
54
  ];
17
55
 
@@ -19,14 +57,27 @@ class FleetStack extends cdk.Stack {
19
57
  public readonly fleet: codebuild.Fleet;
20
58
  public readonly project: codebuild.Project;
21
59
 
22
- constructor(scope: Construct, id: string, computeConfiguration: codebuild.ComputeConfiguration) {
60
+ constructor(scope: Construct, id: string, { computeConfiguration, vpcProps, subnetSelection, securityGroupProps }: StackConfiguration) {
23
61
  super(scope, id);
24
62
 
63
+ let vpc: ec2.Vpc | undefined;
64
+ let securityGroups: Array<ec2.SecurityGroup> | undefined;
65
+ if (vpcProps) {
66
+ vpc = new ec2.Vpc(this, 'Vpc', vpcProps);
67
+ const refinedVpc = vpc;
68
+ securityGroups = securityGroupProps?.map((props, i) =>
69
+ new ec2.SecurityGroup(this, `SecurityGroup${i}`, { ...props, vpc: refinedVpc }),
70
+ );
71
+ }
72
+
25
73
  this.fleet = new codebuild.Fleet(this, 'MyFleet', {
26
74
  baseCapacity: 1,
27
75
  computeType: codebuild.FleetComputeType.ATTRIBUTE_BASED,
28
76
  computeConfiguration,
29
77
  environmentType: codebuild.EnvironmentType.LINUX_CONTAINER,
78
+ vpc,
79
+ securityGroups,
80
+ subnetSelection,
30
81
  });
31
82
 
32
83
  this.project = new codebuild.Project(this, 'MyProject', {
@@ -38,6 +89,7 @@ class FleetStack extends cdk.Stack {
38
89
  }),
39
90
  environment: {
40
91
  buildImage: codebuild.LinuxBuildImage.STANDARD_7_0,
92
+ fleet: this.fleet,
41
93
  },
42
94
  });
43
95
  }
@@ -0,0 +1,130 @@
1
+ import * as ec2 from 'aws-cdk-lib/aws-ec2';
2
+ import * as integ from '@aws-cdk/integ-tests-alpha';
3
+ import * as cdk from 'aws-cdk-lib';
4
+ import * as codebuild from 'aws-cdk-lib/aws-codebuild';
5
+ import { Construct } from 'constructs';
6
+
7
+ type StackConfiguration = {
8
+ computeConfiguration: codebuild.ComputeConfiguration;
9
+ vpcProps?: ec2.VpcProps;
10
+ subnetSelection?: ec2.SubnetSelection;
11
+ securityGroupProps?: Array<Omit<ec2.SecurityGroupProps, 'vpc'>>;
12
+ }
13
+ const configurations: Array<StackConfiguration> = [
14
+ {
15
+ computeConfiguration: {
16
+ instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MEDIUM),
17
+ },
18
+ },
19
+ {
20
+ computeConfiguration: {
21
+ instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MEDIUM),
22
+ disk: cdk.Size.gibibytes(10),
23
+ },
24
+ },
25
+ {
26
+ computeConfiguration: {
27
+ instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MEDIUM),
28
+ },
29
+ vpcProps: {
30
+ maxAzs: 1,
31
+ restrictDefaultSecurityGroup: false,
32
+ },
33
+ },
34
+ {
35
+ computeConfiguration: {
36
+ instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MEDIUM),
37
+ },
38
+ vpcProps: {
39
+ maxAzs: 1,
40
+ // Incredibly, if you pass a SubnetSelection that produces more than 1
41
+ // subnet, you currently get this error:
42
+ // > Resource handler returned message: "Invalid vpc config: the maximum number of subnets is 1
43
+ // This seems like a terrible limitation from the CodeBuild team.
44
+ // maxAzs: 2,
45
+ },
46
+ subnetSelection: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS },
47
+ securityGroupProps: [
48
+ { allowAllOutbound: true },
49
+ { allowAllIpv6Outbound: true },
50
+ ],
51
+ },
52
+ ];
53
+
54
+ class FleetStack extends cdk.Stack {
55
+ public readonly fleet: codebuild.Fleet;
56
+ public readonly project: codebuild.Project;
57
+
58
+ constructor(scope: Construct, id: string, { computeConfiguration, vpcProps, subnetSelection, securityGroupProps }: StackConfiguration) {
59
+ super(scope, id);
60
+
61
+ let vpc: ec2.Vpc | undefined;
62
+ let securityGroups: Array<ec2.SecurityGroup> | undefined;
63
+ if (vpcProps) {
64
+ vpc = new ec2.Vpc(this, 'Vpc', vpcProps);
65
+ const refinedVpc = vpc;
66
+ securityGroups = securityGroupProps?.map((props, i) =>
67
+ new ec2.SecurityGroup(this, `SecurityGroup${i}`, { ...props, vpc: refinedVpc }),
68
+ );
69
+ }
70
+
71
+ this.fleet = new codebuild.Fleet(this, 'MyFleet', {
72
+ baseCapacity: 1,
73
+ computeType: codebuild.FleetComputeType.CUSTOM_INSTANCE_TYPE,
74
+ computeConfiguration,
75
+ environmentType: codebuild.EnvironmentType.LINUX_CONTAINER,
76
+ vpc,
77
+ securityGroups,
78
+ subnetSelection,
79
+ });
80
+
81
+ this.project = new codebuild.Project(this, 'MyProject', {
82
+ buildSpec: codebuild.BuildSpec.fromObject({
83
+ version: '0.2',
84
+ phases: {
85
+ build: { commands: ['echo "Nothing to do!"'] },
86
+ },
87
+ }),
88
+ environment: {
89
+ buildImage: codebuild.LinuxBuildImage.STANDARD_7_0,
90
+ fleet: this.fleet,
91
+ },
92
+ });
93
+ }
94
+ }
95
+
96
+ const app = new cdk.App();
97
+ const stacks = configurations.map(
98
+ (config, index) => new FleetStack(
99
+ app,
100
+ `CustomInstanceTypeComputeFleetIntegStack${index}`,
101
+ config,
102
+ ),
103
+ );
104
+
105
+ const test = new integ.IntegTest(app, 'CustomInstanceTypeComputeFleetIntegTest', {
106
+ testCases: stacks,
107
+ });
108
+
109
+ const listFleets = test.assertions.awsApiCall('Codebuild', 'listFleets');
110
+ for (const { fleet, project } of stacks) {
111
+ listFleets.expect(integ.ExpectedResult.objectLike({
112
+ fleets: integ.Match.arrayWith([fleet.fleetArn]),
113
+ }));
114
+
115
+ const startBuild = test.assertions.awsApiCall('Codebuild', 'startBuild', { projectName: project.projectName });
116
+
117
+ // Describe the build and wait for the status to be successful
118
+ test.assertions.awsApiCall('CodeBuild', 'batchGetBuilds', {
119
+ ids: [startBuild.getAttString('build.id')],
120
+ }).assertAtPath(
121
+ 'builds.0.buildStatus',
122
+ integ.ExpectedResult.stringLikeRegexp('SUCCEEDED'),
123
+ ).waitForAssertions({
124
+ // After a custom instance type fleet is created, there can still be high
125
+ // latency on creating actual instances. Needs a long timeout, builds are
126
+ // pending until instances are initialized.
127
+ totalTimeout: cdk.Duration.minutes(10),
128
+ interval: cdk.Duration.seconds(30),
129
+ });
130
+ }
@@ -0,0 +1,61 @@
1
+ import * as cdk from 'aws-cdk-lib';
2
+ import * as integ from '@aws-cdk/integ-tests-alpha';
3
+ import * as codebuild from 'aws-cdk-lib/aws-codebuild';
4
+ import { Construct } from 'constructs';
5
+
6
+ class FleetStack extends cdk.Stack {
7
+ public readonly fleet: codebuild.Fleet;
8
+ public readonly project: codebuild.Project;
9
+
10
+ constructor(scope: Construct, id: string) {
11
+ super(scope, id);
12
+
13
+ this.fleet = new codebuild.Fleet(this, 'MyFleet', {
14
+ baseCapacity: 1,
15
+ computeType: codebuild.FleetComputeType.SMALL,
16
+ environmentType: codebuild.EnvironmentType.LINUX_CONTAINER,
17
+ overflowBehavior: codebuild.FleetOverflowBehavior.ON_DEMAND,
18
+ });
19
+
20
+ this.project = new codebuild.Project(this, 'MyProject', {
21
+ buildSpec: codebuild.BuildSpec.fromObject({
22
+ version: '0.2',
23
+ phases: {
24
+ build: { commands: ['echo "Nothing to do!"'] },
25
+ },
26
+ }),
27
+ environment: {
28
+ fleet: this.fleet,
29
+ buildImage: codebuild.LinuxBuildImage.STANDARD_7_0,
30
+ },
31
+ });
32
+ }
33
+ }
34
+
35
+ const app = new cdk.App();
36
+ const stack= new FleetStack(
37
+ app,
38
+ 'OverflowBehaviorFleetStack',
39
+ );
40
+
41
+ const test = new integ.IntegTest(app, 'OverflowBehaviorFleetInteg', {
42
+ testCases: [stack],
43
+ });
44
+
45
+ const listFleets = test.assertions.awsApiCall('Codebuild', 'listFleets');
46
+ listFleets.expect(integ.ExpectedResult.objectLike({
47
+ fleets: integ.Match.arrayWith([stack.fleet.fleetArn]),
48
+ }));
49
+
50
+ const startBuild = test.assertions.awsApiCall('Codebuild', 'startBuild', { projectName: stack.project.projectName });
51
+
52
+ // Describe the build and wait for the status to be successful
53
+ test.assertions.awsApiCall('CodeBuild', 'batchGetBuilds', {
54
+ ids: [startBuild.getAttString('build.id')],
55
+ }).assertAtPath(
56
+ 'builds.0.buildStatus',
57
+ integ.ExpectedResult.stringLikeRegexp('SUCCEEDED'),
58
+ ).waitForAssertions({
59
+ totalTimeout: cdk.Duration.minutes(5),
60
+ interval: cdk.Duration.seconds(30),
61
+ });
@@ -1659,6 +1659,107 @@ new ecs.Ec2Service(this, 'EC2Service', {
1659
1659
  });
1660
1660
  ```
1661
1661
 
1662
+ ### Managed Instances Capacity Providers
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.
1665
+
1666
+ To create a Managed Instances Capacity Provider, you need to specify the required EC2 instance profile, and networking configuration. You can also define detailed instance requirements to control which types of instances are used for your workloads.
1667
+
1668
+ ```ts
1669
+ declare const vpc: ec2.Vpc;
1670
+ declare const infrastructureRole: iam.Role;
1671
+ declare const instanceProfile: iam.InstanceProfile;
1672
+
1673
+ const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
1674
+
1675
+ // Create a Managed Instances Capacity Provider
1676
+ const miCapacityProvider = new ecs.ManagedInstancesCapacityProvider(this, 'MICapacityProvider', {
1677
+ infrastructureRole,
1678
+ ec2InstanceProfile: instanceProfile,
1679
+ subnets: vpc.privateSubnets,
1680
+ securityGroups: [new ec2.SecurityGroup(this, 'MISecurityGroup', { vpc })],
1681
+ instanceRequirements: {
1682
+ vCpuCountMin: 1,
1683
+ memoryMin: Size.gibibytes(2),
1684
+ cpuManufacturers: [ec2.CpuManufacturer.INTEL],
1685
+ acceleratorManufacturers: [ec2.AcceleratorManufacturer.NVIDIA],
1686
+ },
1687
+ propagateTags: ecs.PropagateManagedInstancesTags.CAPACITY_PROVIDER,
1688
+ });
1689
+
1690
+ // Add the capacity provider to the cluster
1691
+ cluster.addManagedInstancesCapacityProvider(miCapacityProvider);
1692
+
1693
+ const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef');
1694
+
1695
+ taskDefinition.addContainer('web', {
1696
+ image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
1697
+ memoryReservationMiB: 256,
1698
+ });
1699
+
1700
+ new ecs.Ec2Service(this, 'EC2Service', {
1701
+ cluster,
1702
+ taskDefinition,
1703
+ minHealthyPercent: 100,
1704
+ capacityProviderStrategies: [
1705
+ {
1706
+ capacityProvider: miCapacityProvider.capacityProviderName,
1707
+ weight: 1,
1708
+ },
1709
+ ],
1710
+ });
1711
+ ```
1712
+
1713
+ You can specify detailed instance requirements to control which types of instances are used:
1714
+
1715
+ ```ts
1716
+ declare const infrastructureRole: iam.Role;
1717
+ declare const instanceProfile: iam.InstanceProfile;
1718
+ declare const vpc: ec2.Vpc;
1719
+
1720
+ const miCapacityProvider = new ecs.ManagedInstancesCapacityProvider(this, 'MICapacityProvider', {
1721
+ infrastructureRole,
1722
+ ec2InstanceProfile: instanceProfile,
1723
+ subnets: vpc.privateSubnets,
1724
+ instanceRequirements: {
1725
+ // Required: CPU and memory constraints
1726
+ vCpuCountMin: 2,
1727
+ vCpuCountMax: 8,
1728
+ memoryMin: Size.gibibytes(4),
1729
+ memoryMax: Size.gibibytes(32),
1730
+
1731
+ // CPU preferences
1732
+ cpuManufacturers: [ec2.CpuManufacturer.INTEL, ec2.CpuManufacturer.AMD],
1733
+ instanceGenerations: [ec2.InstanceGeneration.CURRENT],
1734
+
1735
+ // Instance type filtering
1736
+ allowedInstanceTypes: ['m5.*', 'c5.*'],
1737
+
1738
+ // Performance characteristics
1739
+ burstablePerformance: ec2.BurstablePerformance.EXCLUDED,
1740
+ bareMetal: ec2.BareMetal.EXCLUDED,
1741
+
1742
+ // Accelerator requirements (for ML/AI workloads)
1743
+ acceleratorTypes: [ec2.AcceleratorType.GPU],
1744
+ acceleratorManufacturers: [ec2.AcceleratorManufacturer.NVIDIA],
1745
+ acceleratorNames: [ec2.AcceleratorName.T4, ec2.AcceleratorName.V100],
1746
+ acceleratorCountMin: 1,
1747
+
1748
+ // Storage requirements
1749
+ localStorage: ec2.LocalStorage.REQUIRED,
1750
+ localStorageTypes: [ec2.LocalStorageType.SSD],
1751
+ totalLocalStorageGBMin: 100,
1752
+
1753
+ // Network requirements
1754
+ networkInterfaceCountMin: 2,
1755
+ networkBandwidthGbpsMin: 10,
1756
+
1757
+ // Cost optimization
1758
+ onDemandMaxPricePercentageOverLowestPrice: 10,
1759
+ },
1760
+ });
1761
+ ```
1762
+
1662
1763
  ### Cluster Default Provider Strategy
1663
1764
 
1664
1765
  A capacity provider strategy determines whether ECS tasks are launched on EC2 instances or Fargate/Fargate Spot. It can be specified at the cluster, service, or task level, and consists of one or more capacity providers. You can specify an optional base and weight value for finer control of how tasks are launched. The `base` specifies a minimum number of tasks on one capacity provider, and the `weight`s of each capacity provider determine how tasks are distributed after `base` is satisfied.
@@ -0,0 +1,112 @@
1
+ import * as ec2 from 'aws-cdk-lib/aws-ec2';
2
+ import * as iam from 'aws-cdk-lib/aws-iam';
3
+ import * as cdk from 'aws-cdk-lib';
4
+ import * as ecs from 'aws-cdk-lib/aws-ecs';
5
+ import * as integ from '@aws-cdk/integ-tests-alpha';
6
+
7
+ const app = new cdk.App({
8
+ postCliContext: {
9
+ '@aws-cdk/aws-ecs:removeDefaultDeploymentAlarm': true,
10
+ '@aws-cdk/aws-ecs:enableImdsBlockingDeprecatedFeature': false,
11
+ '@aws-cdk/aws-ecs:disableEcsImdsBlocking': false,
12
+ },
13
+ });
14
+ const stack = new cdk.Stack(app, 'integ-managedinstances-capacity-provider');
15
+
16
+ const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2, restrictDefaultSecurityGroup: false });
17
+ const cluster = new ecs.Cluster(stack, 'ManagedInstancesCluster', {
18
+ vpc,
19
+ enableFargateCapacityProviders: true,
20
+ });
21
+
22
+ // Create IAM roles required for FMI following Omakase specifications
23
+ const infrastructureRole = new iam.Role(stack, 'InfrastructureRole', {
24
+ roleName: 'AmazonECSInfrastructureRoleForOmakase',
25
+ assumedBy: new iam.ServicePrincipal('ecs.amazonaws.com'),
26
+ managedPolicies: [
27
+ iam.ManagedPolicy.fromAwsManagedPolicyName('AdministratorAccess'),
28
+ ],
29
+ });
30
+
31
+ const instanceRole = new iam.Role(stack, 'InstanceRole', {
32
+ roleName: 'AmazonECSInstanceRoleForOmakase',
33
+ assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'),
34
+ managedPolicies: [
35
+ iam.ManagedPolicy.fromAwsManagedPolicyName('AdministratorAccess'),
36
+ ],
37
+ });
38
+
39
+ const instanceProfile = new iam.InstanceProfile(stack, 'InstanceProfile', {
40
+ instanceProfileName: 'AmazonECSInstanceRoleForOmakase',
41
+ role: instanceRole,
42
+ });
43
+
44
+ // Create a security group for FMI instances
45
+ const fmiSecurityGroup = new ec2.SecurityGroup(stack, 'ManagedInstancesSecurityGroup', {
46
+ vpc,
47
+ description: 'Security group for ManagedInstances capacity provider instances',
48
+ allowAllOutbound: true,
49
+ });
50
+
51
+ // Create MI Capacity Provider
52
+ const miCapacityProvider = new ecs.ManagedInstancesCapacityProvider(stack, 'ManagedInstancesCapacityProvider', {
53
+ infrastructureRole: infrastructureRole,
54
+ ec2InstanceProfile: instanceProfile,
55
+ subnets: vpc.privateSubnets,
56
+ securityGroups: [fmiSecurityGroup],
57
+ propagateTags: ecs.PropagateManagedInstancesTags.CAPACITY_PROVIDER,
58
+ instanceRequirements: {
59
+ vCpuCountMin: 1,
60
+ memoryMin: cdk.Size.gibibytes(2),
61
+ cpuManufacturers: [ec2.CpuManufacturer.INTEL],
62
+ acceleratorManufacturers: [ec2.AcceleratorManufacturer.NVIDIA],
63
+ },
64
+ });
65
+
66
+ // Add FMI capacity provider to cluster
67
+ cluster.addManagedInstancesCapacityProvider(miCapacityProvider);
68
+ cluster.addDefaultCapacityProviderStrategy([
69
+ {
70
+ capacityProvider: miCapacityProvider.capacityProviderName,
71
+ weight: 1,
72
+ },
73
+ ]);
74
+
75
+ // Create a task definition compatible with Managed Instances and Fargate
76
+ const taskDefinition = new ecs.TaskDefinition(stack, 'TaskDef', {
77
+ compatibility: ecs.Compatibility.FARGATE_AND_MANAGED_INSTANCES,
78
+ cpu: '256',
79
+ memoryMiB: '512',
80
+ networkMode: ecs.NetworkMode.AWS_VPC,
81
+ });
82
+
83
+ taskDefinition.addContainer('web', {
84
+ image: ecs.ContainerImage.fromRegistry('public.ecr.aws/docker/library/httpd:2.4'),
85
+ memoryLimitMiB: 512,
86
+ portMappings: [
87
+ {
88
+ containerPort: 80,
89
+ protocol: ecs.Protocol.TCP,
90
+ },
91
+ ],
92
+ });
93
+
94
+ // Create a service using the MI capacity provider
95
+ new ecs.FargateService(stack, 'ManagedInstancesService', {
96
+ cluster,
97
+ taskDefinition,
98
+ capacityProviderStrategies: [
99
+ {
100
+ capacityProvider: miCapacityProvider.capacityProviderName,
101
+ weight: 1,
102
+ },
103
+ ],
104
+ desiredCount: 1,
105
+ });
106
+
107
+ new integ.IntegTest(app, 'ManagedInstancesCapacityProviders', {
108
+ testCases: [stack],
109
+ regions: ['us-west-2'],
110
+ });
111
+
112
+ app.synth();
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: konokenj.cdk-api-mcp-server
3
- Version: 0.47.0
3
+ Version: 0.48.0
4
4
  Summary: An MCP server provides AWS CDK API Reference
5
5
  Project-URL: Documentation, https://github.com/konokenj/cdk-api-mcp-server#readme
6
6
  Project-URL: Issues, https://github.com/konokenj/cdk-api-mcp-server/issues
@@ -26,7 +26,7 @@ Description-Content-Type: text/markdown
26
26
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/konokenj.cdk-api-mcp-server.svg)](https://pypi.org/project/konokenj.cdk-api-mcp-server)
27
27
 
28
28
  <!-- DEP-VERSIONS-START -->
29
- [![aws-cdk](https://img.shields.io/badge/aws%20cdk-v2.217.0-blue.svg)](https://github.com/konokenj/cdk-api-mcp-server/blob/main/current-versions/aws-cdk.txt)
29
+ [![aws-cdk](https://img.shields.io/badge/aws%20cdk-v2.218.0-blue.svg)](https://github.com/konokenj/cdk-api-mcp-server/blob/main/current-versions/aws-cdk.txt)
30
30
  <!-- DEP-VERSIONS-END -->
31
31
 
32
32
  ---
@@ -1,4 +1,4 @@
1
- cdk_api_mcp_server/__about__.py,sha256=8L-6OWVPIF0futVdaVrf07B6gKzkYZILssN41hDhlOE,129
1
+ cdk_api_mcp_server/__about__.py,sha256=srzMbr0otzQq5BX_rtov_llD8WR7FdcIlipzD5IkGlQ,129
2
2
  cdk_api_mcp_server/__init__.py,sha256=yJA6yIEhJviC-qNlB-nC6UR1JblQci_d84i-viHZkc0,187
3
3
  cdk_api_mcp_server/models.py,sha256=cMS1Hi29M41YjuBxqqrzNrNvyG3MgnUBb1SqYpMCJ30,692
4
4
  cdk_api_mcp_server/resources.py,sha256=R7LVwn29I4BJzU5XAwKbX8j6uy-3ZxcB1b0HzZ_Z2PI,6689
@@ -44,7 +44,7 @@ cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/cfnspec/README.md,sha25
44
44
  cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/custom-resource-handlers/README.md,sha256=QctOoyGt6AqVWeFhRwpkCSxHZ1XFWj_nCKlkJHDFock,965
45
45
  cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/example-construct-library/README.md,sha256=vnVXyvtN9ICph68sw2y6gkdD_gmas0PiUa9TkwNckWQ,4501
46
46
  cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/integ-tests-alpha/README.md,sha256=VifKLrR404_yLVT0E3ai8f3R5K0h22VNwQplpSUSZqc,17489
47
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/README.md/README.md,sha256=5tNXSQdAoxRB2CXlKDpTlt-07OG3yIFqEEMnofQTGxE,76232
47
+ cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/README.md/README.md,sha256=3UAoxAPV0YhySOFVSCnsNgur2YHYqBqJL4LGiWBQ7Tw,76231
48
48
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/assertions/MIGRATING.md,sha256=SYGX8QNB1Pm_rVYDBp4QRWkqwnxOb3CHzeFglUy_53k,3347
49
49
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/assertions/README.md,sha256=3yo3D05n5explTIgnuF-vkk01MTYeAYe7_3rcsD2baE,18299
50
50
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/assets/README.md,sha256=kL56RlfxBa5LwV0cRseybeKIRKHhEXPjUo0HWPZqdO8,53
@@ -325,7 +325,7 @@ cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch-actio
325
325
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch-actions/integ.lambda-alarm-action.ts,sha256=onNZET1IofzJ-_LmnlREFQ3O7MkISTW2OrLrCkJ2qBA,4614
326
326
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch-actions/integ.lambda-alarm-multiple-stepscalingpolicy.ts,sha256=gPLnWcaoTAAlmDYKyHsZz_55lpEDjG92xTNdjEc3IPk,2722
327
327
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch-actions/integ.ssm-incident-alarm-action.ts,sha256=X5iWnwQcAbLQnDkrxd5_rKL-jfw4s60kEQMVFLnCTRk,1895
328
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/README.md,sha256=pKI0s8e1zzvjz4LvKZga20AJxS6kpUEpsysTAP3N9ls,34404
328
+ cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/README.md,sha256=D5zH4G72KjcgUBoxvyeMv5IiibETqfsjFqbsTu5N2ao,37188
329
329
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.asset-build-spec.ts,sha256=APwn0Tzph1El4XowRux9zXXlZO3eXJMFbp3bbovs-AM,1850
330
330
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.aws-deep-learning-container-build-image.ts,sha256=hSyb2cy-zu1rEkNiPybncQaV-Gh63REI95WBpuXeL-Y,488
331
331
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.breakpoint.ts,sha256=ezkSR2Ne1erXri4XV_kMwS4-DUhR5m3EMG1nxzbKZs4,838
@@ -344,7 +344,9 @@ cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.
344
344
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-buildspec-artifacts.ts,sha256=3Fx_jwCa5HW0Dsat2B5hMXrZw_CVldbITSTZRbSGRjo,693
345
345
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-docker-server.ts,sha256=n-TtyWQmaxiI-dWyWe6nZgCDtdn_gvqZAigIT_ugFPI,1301
346
346
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-file-system-location.ts,sha256=t1I6uabPbfoaQ7lzP2EJIbvB3_5vkTrr_oQRh69_HQk,1060
347
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-fleet-attribute-based-compute.ts,sha256=ttHvMAKsoo0zEF4f82x6cSyI_2QA0se6zrXoN64A2WY,2303
347
+ cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-fleet-attribute-based-compute.ts,sha256=dAC9hW95FKgQl9sc_I4YK7UzIYcEZUrDblmlqd-bVJo,3930
348
+ cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-fleet-custom-instance-type.ts,sha256=tobSWcbc6bd9De3brfmqAqV5_muT3FlOJPee378ff5g,4248
349
+ cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-fleet-overflow-behavior.ts,sha256=XqE1fRey0AoXWUOIKSlBo_9uumqzL_hUayqXo21uU0c,1895
348
350
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-fleet.ts,sha256=kCXeV4i_mq2JFzvTDox6rv10no6LOZ-bb_Gk6aSa7A4,1913
349
351
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-linux-arm-lambda-image.lit.ts,sha256=f8fQCveGRs6yCEF0Shkww6BxGs1_iOb8QGl5nZg-138,1282
350
352
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-linux-arm.ts,sha256=cB-WiW6Vy4hK5vNbozAHUTX2UduHf2L2Yghm-bNF4uM,1318
@@ -583,7 +585,7 @@ cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr-assets/integ
583
585
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr-assets/integ.assets-tarball.ts,sha256=pSbNMWSorKT7lUTXxnzkxpcRumKPYWUmcbqRSwwWOgI,937
584
586
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr-assets/integ.nested-stacks-docker.ts,sha256=4hDobse34oIG2r0mjbYXzsEXXLEqv077jUh3pjoYmcc,981
585
587
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/CONTRIBUTING.md,sha256=TlNwpeYemLdYq4jdo24v7nwDIj3RmZ7u2j_LCQiQR74,2634
586
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/README.md,sha256=3x7qZzMSZhlUITrPhNTscpSQbBQV34cDMADTqmOA7uc,75808
588
+ cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/README.md,sha256=g4z6674_NsRjkJoBj0eGXlWp03nQyapkjdJkiJ0GUUw,79348
587
589
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.add-docker-label.ts,sha256=avHktilCBVPuVelquVaY2ylRkSLraWn7vUIIIFPsbyI,1375
588
590
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.add-environment-variable.ts,sha256=sIdwJl7LYh5wlv_EDLPSGCavC2OF6W8IBwZ_hMOnCfw,1143
589
591
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.app-mesh-proxy-config.ts,sha256=vWr45An7W7lgW9Ws_yPFhapf9DXyJP-D0fhTNg5fZC0,1717
@@ -625,6 +627,7 @@ cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.gravit
625
627
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.graviton.ts,sha256=SfImqll0RwSnvXxB_UIb8pQbdN_OxFfUVsq69lI4k2o,840
626
628
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.lb-awsvpc-nw.ts,sha256=Rwqi34a5qRjNqLnbh6bNgb46CVDnGD7WGWGWm321w24,1623
627
629
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.lb-bridge-nw.ts,sha256=sxV4f9fRvG2aTwDI0rUfipuE8yQFZy0CWUTd3H0OdUc,1632
630
+ cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.managedinstances-capacity-provider.ts,sha256=oGNex2Yj_aHaaRp9rUfWerjJv7O91Ls4ChkJXqmjgpE,3561
628
631
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.nlb-awsvpc-nw.ts,sha256=vXdMwV8Ythm3Qa4cHX_mg0WjRESCMYe0GgA3tX_uqTk,1474
629
632
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.placement-constraint-default-empty.ts,sha256=mMQZyejxLzLlENEuiDk7GKa1syiPkpb6xb6DEtYH62s,1490
630
633
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.placement-strategies.ts,sha256=W797uZbgznmaIVRYBaguJ3cM9OxXi70utWvE3g-nPiM,1424
@@ -1414,8 +1417,8 @@ cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/integ.pipe
1414
1417
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/region-info/README.md,sha256=vewWkV3ds9o9iyyYaJBNTkaKJ2XA6K2yF17tAxUnujg,2718
1415
1418
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/triggers/README.md,sha256=hYIx7DbG_7p4LYLUfxDwgIQjw9UNdz1GLrqDe8_Dbko,4132
1416
1419
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/triggers/integ.triggers.ts,sha256=4OHplMoBOgHGkktAzoU-TuNmJQS5wGAUvBfj5bGSe_Y,2807
1417
- konokenj_cdk_api_mcp_server-0.47.0.dist-info/METADATA,sha256=XOyf695Rswja2-w_gzNMI_s7OkNACCDiH7uzU4TFmo8,2646
1418
- konokenj_cdk_api_mcp_server-0.47.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
1419
- konokenj_cdk_api_mcp_server-0.47.0.dist-info/entry_points.txt,sha256=bVDhMdyCC1WNMPOMbmB82jvWII2CIrwTZDygdCf0cYQ,79
1420
- konokenj_cdk_api_mcp_server-0.47.0.dist-info/licenses/LICENSE.txt,sha256=5OIAASeg1HM22mVZ1enz9bgZ7TlsGfWXnj02P9OgFyk,1098
1421
- konokenj_cdk_api_mcp_server-0.47.0.dist-info/RECORD,,
1420
+ konokenj_cdk_api_mcp_server-0.48.0.dist-info/METADATA,sha256=DlxK8jwG-lfIznfwyArD_Rgn_I07ZrlH_ftIRTLM1y8,2646
1421
+ konokenj_cdk_api_mcp_server-0.48.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
1422
+ konokenj_cdk_api_mcp_server-0.48.0.dist-info/entry_points.txt,sha256=bVDhMdyCC1WNMPOMbmB82jvWII2CIrwTZDygdCf0cYQ,79
1423
+ konokenj_cdk_api_mcp_server-0.48.0.dist-info/licenses/LICENSE.txt,sha256=5OIAASeg1HM22mVZ1enz9bgZ7TlsGfWXnj02P9OgFyk,1098
1424
+ konokenj_cdk_api_mcp_server-0.48.0.dist-info/RECORD,,