Class AmazonLinuxImage
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.ec2.GenericSSMParameterImage
software.amazon.awscdk.services.ec2.AmazonLinuxImage
- All Implemented Interfaces:
IMachineImage,software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-17T14:40:49.348Z")
@Stability(Stable)
public class AmazonLinuxImage
extends GenericSSMParameterImage
Selects the latest version of Amazon Linux.
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.
Example:
IVpc vpc;
LoadBalancer lb = LoadBalancer.Builder.create(this, "LB")
.vpc(vpc)
.internetFacing(true)
.build();
// instance to add as the target for load balancer.
Instance instance = Instance.Builder.create(this, "targetInstance")
.vpc(vpc)
.instanceType(InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.MICRO))
.machineImage(AmazonLinuxImage.Builder.create().generation(AmazonLinuxGeneration.AMAZON_LINUX_2).build())
.build();
lb.addTarget(new InstanceTarget(instance));
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.ec2.IMachineImage
IMachineImage.Jsii$Default, IMachineImage.Jsii$Proxy -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAmazonLinuxImage(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedAmazonLinuxImage(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptiongetImage(software.constructs.Construct scope) Return the image to use in the given context.static StringReturn the SSM parameter name that will contain the Amazon Linux image with the given attributes.static StringReturn the SSM parameter name that will contain the Amazon Linux image with the given attributes.Methods inherited from class software.amazon.awscdk.services.ec2.GenericSSMParameterImage
getParameterNameMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
AmazonLinuxImage
protected AmazonLinuxImage(software.amazon.jsii.JsiiObjectRef objRef) -
AmazonLinuxImage
protected AmazonLinuxImage(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
AmazonLinuxImage
- Parameters:
props-
-
AmazonLinuxImage
@Stability(Stable) public AmazonLinuxImage()
-
-
Method Details
-
ssmParameterName
@Stability(Stable) @NotNull public static String ssmParameterName(@Nullable AmazonLinuxImageProps props) Return the SSM parameter name that will contain the Amazon Linux image with the given attributes.- Parameters:
props-
-
ssmParameterName
Return the SSM parameter name that will contain the Amazon Linux image with the given attributes. -
getImage
@Stability(Stable) @NotNull public MachineImageConfig getImage(@NotNull software.constructs.Construct scope) Return the image to use in the given context.- Specified by:
getImagein interfaceIMachineImage- Overrides:
getImagein classGenericSSMParameterImage- Parameters:
scope- This parameter is required.
-