Show / Hide Table of Contents

Class AmazonLinuxImageProps

Amazon Linux image properties.

Inheritance
object
AmazonLinuxImageProps
Implements
IAmazonLinuxImageProps
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AmazonLinuxImageProps : IAmazonLinuxImageProps
Syntax (vb)
Public Class AmazonLinuxImageProps 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()

Amazon Linux image properties.

Properties

AdditionalCacheKey

Adds an additional discriminator to the cdk.context.json cache key.

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()

Amazon Linux image properties.

public AmazonLinuxImageProps()
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));

Properties

AdditionalCacheKey

Adds an additional discriminator to the cdk.context.json cache key.

public string? AdditionalCacheKey { get; set; }
Property Value

string

Remarks

Default: - no additional cache key

CachedInContext

Whether the AMI ID is cached to be stable between deployments.

public bool? CachedInContext { get; set; }
Property Value

bool?

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 AmazonLinuxCpuType? CpuType { get; set; }
Property Value

AmazonLinuxCpuType?

Remarks

Default: X86_64

Edition

What edition of Amazon Linux to use.

public AmazonLinuxEdition? Edition { get; set; }
Property Value

AmazonLinuxEdition?

Remarks

Default: Standard

Generation

What generation of Amazon Linux to use.

public AmazonLinuxGeneration? Generation { get; set; }
Property Value

AmazonLinuxGeneration?

Remarks

Default: AmazonLinux

Kernel

What kernel version of Amazon Linux to use.

public AmazonLinuxKernel? Kernel { get; set; }
Property Value

AmazonLinuxKernel?

Remarks

Default: -

Storage

What storage backed image to use.

public AmazonLinuxStorage? Storage { get; set; }
Property Value

AmazonLinuxStorage?

Remarks

Default: GeneralPurpose

UserData

Initial user data.

public UserData? UserData { get; set; }
Property Value

UserData

Remarks

Default: - Empty UserData for Linux machines

Virtualization

Virtualization type.

public AmazonLinuxVirt? Virtualization { get; set; }
Property Value

AmazonLinuxVirt?

Remarks

Default: HVM

Implements

IAmazonLinuxImageProps
Back to top Generated by DocFX