Interface IAmazonLinuxImageProps
Amazon Linux image properties.
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.AWS.EC2.dll
Syntax (csharp)
public interface IAmazonLinuxImageProps
Syntax (vb)
Public Interface IAmazonLinuxImageProps
Remarks
ExampleMetadata: infused
Examples
var sg = SecurityGroup.FromSecurityGroupId(this, "FsxSecurityGroup", "{SECURITY-GROUP-ID}");
var fs = LustreFileSystem.FromLustreFileSystemAttributes(this, "FsxLustreFileSystem", new FileSystemAttributes {
DnsName = "{FILE-SYSTEM-DNS-NAME}",
FileSystemId = "{FILE-SYSTEM-ID}",
SecurityGroup = sg
});
var vpc = Vpc.FromVpcAttributes(this, "Vpc", new VpcAttributes {
AvailabilityZones = new [] { "us-west-2a", "us-west-2b" },
PublicSubnetIds = new [] { "{US-WEST-2A-SUBNET-ID}", "{US-WEST-2B-SUBNET-ID}" },
VpcId = "{VPC-ID}"
});
var inst = new Instance(this, "inst", new InstanceProps {
InstanceType = InstanceType.Of(InstanceClass.T2, InstanceSize.LARGE),
MachineImage = new AmazonLinuxImage(new AmazonLinuxImageProps {
Generation = AmazonLinuxGeneration.AMAZON_LINUX_2
}),
Vpc = vpc,
VpcSubnets = new SubnetSelection {
SubnetType = SubnetType.PUBLIC
}
});
fs.Connections.AllowDefaultPortFrom(inst);
Synopsis
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. |
Properties
CachedInContext
Whether the AMI ID is cached to be stable between deployments.
virtual Nullable<bool> CachedInContext { get; }
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.
virtual Nullable<AmazonLinuxCpuType> CpuType { get; }
Property Value
System.Nullable<AmazonLinuxCpuType>
Remarks
Default: X86_64
Edition
What edition of Amazon Linux to use.
virtual Nullable<AmazonLinuxEdition> Edition { get; }
Property Value
System.Nullable<AmazonLinuxEdition>
Remarks
Default: Standard
Generation
What generation of Amazon Linux to use.
virtual Nullable<AmazonLinuxGeneration> Generation { get; }
Property Value
System.Nullable<AmazonLinuxGeneration>
Remarks
Default: AmazonLinux
Kernel
What kernel version of Amazon Linux to use.
virtual Nullable<AmazonLinuxKernel> Kernel { get; }
Property Value
System.Nullable<AmazonLinuxKernel>
Remarks
Default: -
Storage
What storage backed image to use.
virtual Nullable<AmazonLinuxStorage> Storage { get; }
Property Value
System.Nullable<AmazonLinuxStorage>
Remarks
Default: GeneralPurpose
UserData
Initial user data.
virtual UserData UserData { get; }
Property Value
Remarks
Default: - Empty UserData for Linux machines
Virtualization
Virtualization type.
virtual Nullable<AmazonLinuxVirt> Virtualization { get; }
Property Value
System.Nullable<AmazonLinuxVirt>
Remarks
Default: HVM