Show / Hide Table of Contents

Class SsmParameterImageOptions

Properties for GenericSsmParameterImage.

Inheritance
System.Object
SsmParameterImageOptions
Implements
ISsmParameterImageOptions
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.AWS.EC2.dll
Syntax (csharp)
public class SsmParameterImageOptions : Object, ISsmParameterImageOptions
Syntax (vb)
Public Class SsmParameterImageOptions
    Inherits Object
    Implements ISsmParameterImageOptions
Remarks

ExampleMetadata: lit=test/example.images.lit.ts infused

Examples
// Pick the right Amazon Linux edition. All arguments shown are optional
// and will default to these values when omitted.
var amznLinux = MachineImage.LatestAmazonLinux(new AmazonLinuxImageProps {
    Generation = AmazonLinuxGeneration.AMAZON_LINUX,
    Edition = AmazonLinuxEdition.STANDARD,
    Virtualization = AmazonLinuxVirt.HVM,
    Storage = AmazonLinuxStorage.GENERAL_PURPOSE,
    CpuType = AmazonLinuxCpuType.X86_64
});

// Pick a Windows edition to use
var windows = MachineImage.LatestWindows(WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE);

// Read AMI id from SSM parameter store
var ssm = MachineImage.FromSsmParameter("/my/ami", new SsmParameterImageOptions { Os = OperatingSystemType.LINUX });

// Look up the most recent image matching a set of AMI filters.
// In this case, look up the NAT instance AMI, by using a wildcard
// in the 'name' field:
var natAmi = MachineImage.Lookup(new LookupMachineImageProps {
    Name = "amzn-ami-vpc-nat-*",
    Owners = new [] { "amazon" }
});

// For other custom (Linux) images, instantiate a `GenericLinuxImage` with
// a map giving the AMI to in for each region:
var linux = MachineImage.GenericLinux(new Dictionary<string, string> {
    { "us-east-1", "ami-97785bed" },
    { "eu-west-1", "ami-12345678" }
});

// For other custom (Windows) images, instantiate a `GenericWindowsImage` with
// a map giving the AMI to in for each region:
var genericWindows = MachineImage.GenericWindows(new Dictionary<string, string> {
    { "us-east-1", "ami-97785bed" },
    { "eu-west-1", "ami-12345678" }
});

Synopsis

Constructors

SsmParameterImageOptions()

Properties

CachedInContext

Whether the AMI ID is cached to be stable between deployments.

Os

Operating system.

UserData

Custom UserData.

Constructors

SsmParameterImageOptions()

public SsmParameterImageOptions()

Properties

CachedInContext

Whether the AMI ID is cached to be stable between deployments.

public Nullable<bool> CachedInContext { get; set; }
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

Os

Operating system.

public Nullable<OperatingSystemType> Os { get; set; }
Property Value

System.Nullable<OperatingSystemType>

Remarks

Default: OperatingSystemType.LINUX

UserData

Custom UserData.

public UserData UserData { get; set; }
Property Value

UserData

Remarks

Default: - UserData appropriate for the OS

Implements

ISsmParameterImageOptions
Back to top Generated by DocFX