Class AmazonLinuxImageProps
Amazon Linux image properties.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AmazonLinuxImageProps : Object, IAmazonLinuxImageProps
Syntax (vb)
Public Class AmazonLinuxImageProps
Inherits Object
Implements IAmazonLinuxImageProps
Remarks
ExampleMetadata: infused
Examples
IVpc vpc;
var lb = new LoadBalancer(this, "LB", new LoadBalancerProps {
Vpc = vpc,
InternetFacing = true
});
// instance to add as the target for load balancer.
var instance = new Instance(this, "targetInstance", new InstanceProps {
Vpc = vpc,
InstanceType = InstanceType.Of(InstanceClass.BURSTABLE2, InstanceSize.MICRO),
MachineImage = new AmazonLinuxImage(new AmazonLinuxImageProps { Generation = AmazonLinuxGeneration.AMAZON_LINUX_2 })
});
lb.AddTarget(new InstanceTarget(instance));
Synopsis
Constructors
AmazonLinuxImageProps() |
Properties
CachedInContext | Whether the AMI ID is cached to be stable between deployments. |
CpuType | CPU Type. |
Edition | What edition of Amazon Linux to use. |
Generation | What generation of Amazon Linux to use. |
Kernel | What kernel version of Amazon Linux to use. |
Storage | What storage backed image to use. |
UserData | Initial user data. |
Virtualization | Virtualization type. |
Constructors
AmazonLinuxImageProps()
public AmazonLinuxImageProps()
Properties
CachedInContext
Whether the AMI ID is cached to be stable between deployments.
public Nullable<bool> CachedInContext { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on.
If set to true, the AMI ID will be cached in cdk.context.json
and the
same value will be used on future runs. Your instances will not be replaced
but your AMI version will grow old over time. To refresh the AMI lookup,
you will have to evict the value from the cache using the cdk context
command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for
more information.
Can not be set to true
in environment-agnostic stacks.
Default: false
CpuType
CPU Type.
public Nullable<AmazonLinuxCpuType> CpuType { get; set; }
Property Value
System.Nullable<AmazonLinuxCpuType>
Remarks
Default: X86_64
Edition
What edition of Amazon Linux to use.
public Nullable<AmazonLinuxEdition> Edition { get; set; }
Property Value
System.Nullable<AmazonLinuxEdition>
Remarks
Default: Standard
Generation
What generation of Amazon Linux to use.
public Nullable<AmazonLinuxGeneration> Generation { get; set; }
Property Value
System.Nullable<AmazonLinuxGeneration>
Remarks
Default: AmazonLinux
Kernel
What kernel version of Amazon Linux to use.
public Nullable<AmazonLinuxKernel> Kernel { get; set; }
Property Value
System.Nullable<AmazonLinuxKernel>
Remarks
Default: -
Storage
What storage backed image to use.
public Nullable<AmazonLinuxStorage> Storage { get; set; }
Property Value
System.Nullable<AmazonLinuxStorage>
Remarks
Default: GeneralPurpose
UserData
Initial user data.
public UserData UserData { get; set; }
Property Value
Remarks
Default: - Empty UserData for Linux machines
Virtualization
Virtualization type.
public Nullable<AmazonLinuxVirt> Virtualization { get; set; }
Property Value
System.Nullable<AmazonLinuxVirt>
Remarks
Default: HVM