Class EcsOptimizedImage
Construct a Linux or Windows machine image from the latest ECS Optimized AMI published in SSM.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.AWS.ECS.dll
Syntax (csharp)
public class EcsOptimizedImage : DeputyBase, IMachineImage
Syntax (vb)
Public Class EcsOptimizedImage
Inherits DeputyBase
Implements IMachineImage
Remarks
ExampleMetadata: infused
Examples
Vpc vpc;
var cluster = new Cluster(this, "Cluster", new ClusterProps {
Vpc = vpc
});
// Either add default capacity
cluster.AddCapacity("DefaultAutoScalingGroupCapacity", new AddCapacityOptions {
InstanceType = new InstanceType("t2.xlarge"),
DesiredCapacity = 3
});
// Or add customized capacity. Be sure to start the Amazon ECS-optimized AMI.
var autoScalingGroup = new AutoScalingGroup(this, "ASG", new AutoScalingGroupProps {
Vpc = vpc,
InstanceType = new InstanceType("t2.xlarge"),
MachineImage = EcsOptimizedImage.AmazonLinux(),
// Or use Amazon ECS-Optimized Amazon Linux 2 AMI
// machineImage: EcsOptimizedImage.amazonLinux2(),
DesiredCapacity = 3
});
var capacityProvider = new AsgCapacityProvider(this, "AsgCapacityProvider", new AsgCapacityProviderProps {
AutoScalingGroup = autoScalingGroup
});
cluster.AddAsgCapacityProvider(capacityProvider);
Synopsis
Constructors
EcsOptimizedImage(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
EcsOptimizedImage(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Methods
AmazonLinux(IEcsOptimizedImageOptions) | Construct an Amazon Linux AMI image from the latest ECS Optimized AMI published in SSM. |
AmazonLinux2(Nullable<AmiHardwareType>, IEcsOptimizedImageOptions) | Construct an Amazon Linux 2 image from the latest ECS Optimized AMI published in SSM. |
GetImage(Construct) | Return the correct image. |
Windows(WindowsOptimizedVersion, IEcsOptimizedImageOptions) | Construct a Windows image from the latest ECS Optimized AMI published in SSM. |
Constructors
EcsOptimizedImage(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected EcsOptimizedImage(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
EcsOptimizedImage(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected EcsOptimizedImage(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Methods
AmazonLinux(IEcsOptimizedImageOptions)
Construct an Amazon Linux AMI image from the latest ECS Optimized AMI published in SSM.
public static EcsOptimizedImage AmazonLinux(IEcsOptimizedImageOptions options = null)
Parameters
- options IEcsOptimizedImageOptions
Returns
AmazonLinux2(Nullable<AmiHardwareType>, IEcsOptimizedImageOptions)
Construct an Amazon Linux 2 image from the latest ECS Optimized AMI published in SSM.
public static EcsOptimizedImage AmazonLinux2(Nullable<AmiHardwareType> hardwareType = null, IEcsOptimizedImageOptions options = null)
Parameters
- hardwareType System.Nullable<AmiHardwareType>
ECS-optimized AMI variant to use.
- options IEcsOptimizedImageOptions
ECS-optimized AMI variant to use.
Returns
GetImage(Construct)
Return the correct image.
public virtual IMachineImageConfig GetImage(Construct scope)
Parameters
- scope Construct
Returns
Windows(WindowsOptimizedVersion, IEcsOptimizedImageOptions)
Construct a Windows image from the latest ECS Optimized AMI published in SSM.
public static EcsOptimizedImage Windows(WindowsOptimizedVersion windowsVersion, IEcsOptimizedImageOptions options = null)
Parameters
- windowsVersion WindowsOptimizedVersion
Windows Version to use.
- options IEcsOptimizedImageOptions
Windows Version to use.
Returns