Skip to content
v2.274.0

GenericSSMParameterImage Class ​

Select the image based on a given SSM parameter at deployment time of the CloudFormation Stack.

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 ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';

declare const userData: ec2.UserData;
const genericSSMParameterImage = new ec2.GenericSSMParameterImage('parameterName', ec2.OperatingSystemType.LINUX, /* all optional props */ userData);
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2

# user_data: ec2.UserData

generic_ssm_parameter_image = ec2.GenericSSMParameterImage("parameterName", ec2.OperatingSystemType.LINUX, user_data)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;

UserData userData;

GenericSSMParameterImage genericSSMParameterImage = new GenericSSMParameterImage("parameterName", OperatingSystemType.LINUX, userData);
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;

UserData userData;

var genericSSMParameterImage = new GenericSSMParameterImage("parameterName", OperatingSystemType.LINUX, userData);
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var userData UserData

genericSSMParameterImage := awscdk.Aws_ec2.NewGenericSSMParameterImage(jsii.String("parameterName"), awscdk.Aws_ec2.OperatingSystemType_LINUX, userData)

Initializer ​

ts
new GenericSSMParameterImage(parameterName: string, os: OperatingSystemType, userData?: UserData)
python
GenericSSMParameterImage(parameter_name: str, os: OperatingSystemType, user_data: typing.Optional[UserData] = None)
java
new GenericSSMParameterImage(String parameterName, OperatingSystemType os, UserData userData)
csharp
new GenericSSMParameterImage(string parameterName, OperatingSystemType os, UserData? userData = null)
go
NewGenericSSMParameterImage(ParameterName *string, Os OperatingSystemType, UserData UserData)

Properties ​

parameterNamestringparameter_namestrparameterNameStringParameterNamestringParameterName*stringrequired#
Name of the SSM parameter we're looking up.

Methods ​

getImage(scope: Construct): MachineImageConfigdef get_image(self, scope: Construct) -> MachineImageConfigpublic MachineImageConfig getImage(Construct scope)public MachineImageConfig GetImage(Construct scope)func GetImage(Scope Construct) MachineImageConfig#
Return the image to use in the given context.