Class AmazonLinuxImage
Selects the latest version of Amazon Linux.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.AWS.EC2.dll
Syntax (csharp)
public class AmazonLinuxImage : GenericSSMParameterImage, IMachineImage
Syntax (vb)
Public Class AmazonLinuxImage
Inherits GenericSSMParameterImage
Implements IMachineImage
Remarks
This Machine Image automatically updates to the latest version on every deployment. Be aware this will cause your instances to be replaced when a new version of the image becomes available. Do not store stateful information on the instance if you are using this image.
The AMI ID is selected using the values published to the SSM parameter store.
ExampleMetadata: lit=test/example.images.lit.ts infused
Examples
// Pick a Windows edition to use
var windows = new WindowsImage(WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE);
// Pick the right Amazon Linux edition. All arguments shown are optional
// and will default to these values when omitted.
var amznLinux = new AmazonLinuxImage(new AmazonLinuxImageProps {
Generation = AmazonLinuxGeneration.AMAZON_LINUX,
Edition = AmazonLinuxEdition.STANDARD,
Virtualization = AmazonLinuxVirt.HVM,
Storage = AmazonLinuxStorage.GENERAL_PURPOSE
});
// For other custom (Linux) images, instantiate a `GenericLinuxImage` with
// a map giving the AMI to in for each region:
var linux = new GenericLinuxImage(new Dictionary<string, string> {
{ "us-east-1", "ami-97785bed" },
{ "eu-west-1", "ami-12345678" }
});
Synopsis
Constructors
AmazonLinuxImage(IAmazonLinuxImageProps) | |
AmazonLinuxImage(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
AmazonLinuxImage(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Methods
GetImage(Construct) | Return the image to use in the given context. |
SsmParameterName(IAmazonLinuxImageProps) | Return the SSM parameter name that will contain the Amazon Linux image with the given attributes. |
Constructors
AmazonLinuxImage(IAmazonLinuxImageProps)
public AmazonLinuxImage(IAmazonLinuxImageProps props = null)
Parameters
- props IAmazonLinuxImageProps
AmazonLinuxImage(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected AmazonLinuxImage(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
AmazonLinuxImage(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected AmazonLinuxImage(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Methods
GetImage(Construct)
Return the image to use in the given context.
public override IMachineImageConfig GetImage(Construct scope)
Parameters
- scope Construct
Returns
Overrides
SsmParameterName(IAmazonLinuxImageProps)
Return the SSM parameter name that will contain the Amazon Linux image with the given attributes.
public static string SsmParameterName(IAmazonLinuxImageProps props = null)
Parameters
- props IAmazonLinuxImageProps
Returns
System.String