CapacityProvider
Source:
src/AWS/ECS/CapacityProvider.ts
An Amazon ECS capacity provider backed by an EC2 Auto Scaling Group.
Capacity providers are associated with one or more ECS clusters via {@link Cluster#capacityProviders} and are referenced by a service or task’s capacity provider strategy.
Only EC2 Auto Scaling Group-backed capacity providers are currently
supported. The reserved AWS providers FARGATE and FARGATE_SPOT do not
need to be created and can be referenced by name on a Cluster directly.
Creating Capacity Providers
Section titled “Creating Capacity Providers”const provider = yield* CapacityProvider("AppCapacityProvider", { autoScalingGroupArn: asg.autoScalingGroupArn, managedScaling: { status: "ENABLED", targetCapacity: 80, minimumScalingStepSize: 1, maximumScalingStepSize: 10, }, managedTerminationProtection: "ENABLED",});
yield* Cluster("AppCluster", { capacityProviders: [provider.name], defaultCapacityProviderStrategy: [ { capacityProvider: provider.name, weight: 1 }, ],});Adopting Existing Capacity Providers
Section titled “Adopting Existing Capacity Providers”import { adopt } from "alchemy/AdoptPolicy";
yield* CapacityProvider("AppCapacityProvider", { name: "existing-provider", autoScalingGroupArn: asg.autoScalingGroupArn,}).pipe(adopt());