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.116.0 (build 0eddcff)",
           date="2025-10-29T11:15:36.680Z")
@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 SummaryNested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObjectsoftware.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.ec2.IMachineImageIMachineImage.Jsii$Default, IMachineImage.Jsii$Proxy
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAmazonLinuxImage(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedAmazonLinuxImage(software.amazon.jsii.JsiiObjectRef objRef) 
- 
Method SummaryModifier 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.GenericSSMParameterImagegetParameterNameMethods inherited from class software.amazon.jsii.JsiiObjectjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable$jsii$toJson
- 
Constructor Details- 
AmazonLinuxImageprotected AmazonLinuxImage(software.amazon.jsii.JsiiObjectRef objRef) 
- 
AmazonLinuxImageprotected 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-
 
- 
ssmParameterNameReturn 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 interface- IMachineImage
- Overrides:
- getImagein class- GenericSSMParameterImage
- Parameters:
- scope- This parameter is required.
 
 
-