LaunchConfiguration class

Provides a resource to create a new launch configuration, used for autoscaling groups.

> WARNING: The use of launch configurations is discouraged in favor of launch templates. Read more in the AWS EC2 Documentation.

> Note When using aws.ec2.LaunchConfiguration with aws.autoscaling.Group, it is recommended to use the namePrefix (Optional) instead of the name (Optional) attribute.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const ubuntu = aws.ec2.getAmi({
    filters: [
        {
            name: "name",
            values: ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"],
        },
        {
            name: "virtualization-type",
            values: ["hvm"],
        },
    ],
    mostRecent: true,
    owners: ["099720109477"],
});
const asConf = new aws.ec2.LaunchConfiguration("as_conf", {
    name: "web_config",
    imageId: ubuntu.then(ubuntu => ubuntu.id),
    instanceType: "t2.micro",
});
import pulumi
import pulumi_aws as aws

ubuntu = aws.ec2.get_ami(filters=[
        {
            "name": "name",
            "values": ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"],
        },
        {
            "name": "virtualization-type",
            "values": ["hvm"],
        },
    ],
    most_recent=True,
    owners=["099720109477"])
as_conf = aws.ec2.LaunchConfiguration("as_conf",
    name="web_config",
    image_id=ubuntu.id,
    instance_type="t2.micro")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var ubuntu = Aws.Ec2.GetAmi.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ec2.Inputs.GetAmiFilterInputArgs
            {
                Name = "name",
                Values = new[]
                {
                    "ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*",
                },
            },
            new Aws.Ec2.Inputs.GetAmiFilterInputArgs
            {
                Name = "virtualization-type",
                Values = new[]
                {
                    "hvm",
                },
            },
        },
        MostRecent = true,
        Owners = new[]
        {
            "099720109477",
        },
    });

    var asConf = new Aws.Ec2.LaunchConfiguration("as_conf", new()
    {
        Name = "web_config",
        ImageId = ubuntu.Apply(getAmiResult => getAmiResult.Id),
        InstanceType = "t2.micro",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ubuntu, err := ec2.LookupAmi(ctx, &ec2.LookupAmiArgs{
			Filters: []ec2.GetAmiFilter{
				{
					Name: "name",
					Values: []string{
						"ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*",
					},
				},
				{
					Name: "virtualization-type",
					Values: []string{
						"hvm",
					},
				},
			},
			MostRecent: pulumi.BoolRef(true),
			Owners: []string{
				"099720109477",
			},
		}, nil)
		if err != nil {
			return err
		}
		_, err = ec2.NewLaunchConfiguration(ctx, "as_conf", &ec2.LaunchConfigurationArgs{
			Name:         pulumi.String("web_config"),
			ImageId:      pulumi.String(ubuntu.Id),
			InstanceType: pulumi.String("t2.micro"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

data "aws_ec2_getami" "ubuntu" {
  filters {
    name   = "name"
    values = ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"]
  }
  filters {
    name   = "virtualization-type"
    values = ["hvm"]
  }
  most_recent = true
  owners      = ["099720109477"]
}

# Canonical
resource "aws_ec2_launchconfiguration" "as_conf" {
  name          = "web_config"
  image_id      = data.aws_ec2_getami.ubuntu.id
  instance_type = "t2.micro"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetAmiArgs;
import com.pulumi.aws.ec2.inputs.GetAmiFilterArgs;
import com.pulumi.aws.ec2.LaunchConfiguration;
import com.pulumi.aws.ec2.LaunchConfigurationArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var ubuntu = Ec2Functions.getAmi(GetAmiArgs.builder()
            .filters(
                GetAmiFilterArgs.builder()
                    .name("name")
                    .values("ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*")
                    .build(),
                GetAmiFilterArgs.builder()
                    .name("virtualization-type")
                    .values("hvm")
                    .build())
            .mostRecent(true)
            .owners("099720109477")
            .build());

        var asConf = new LaunchConfiguration("asConf", LaunchConfigurationArgs.builder()
            .name("web_config")
            .imageId(ubuntu.id())
            .instanceType("t2.micro")
            .build());

    }
}
resources:
  asConf:
    type: aws:ec2:LaunchConfiguration
    name: as_conf
    properties:
      name: web_config
      imageId: ${ubuntu.id}
      instanceType: t2.micro
variables:
  ubuntu:
    fn::invoke:
      function: aws:ec2:getAmi
      arguments:
        filters:
          - name: name
            values:
              - ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*
          - name: virtualization-type
            values:
              - hvm
        mostRecent: true
        owners:
          - '099720109477'

Optional

  • accountId (String) AWS Account where this resource is managed.
  • region (String) Region where this resource is managed.

Using pulumi import, import launch configurations using the name. For example:

$ pulumi import aws:ec2/launchConfiguration:LaunchConfiguration example example

Constructors

LaunchConfiguration(String name, {LaunchConfigurationArgs? args, CustomResourceOptions? options})
Creates a new LaunchConfiguration. name The Pulumi resource name. args Arguments used to configure this LaunchConfiguration. The set of arguments for LaunchConfiguration. options Resource options controlling this resource's behavior.
LaunchConfiguration.reference(String urn)
Creates a typed reference to an existing LaunchConfiguration resource.

Properties

arn ↔ Output<String>
ARN of the launch configuration.
latefinal
associatePublicIpAddress ↔ Output<bool?>
Associate a public ip address with an instance in a VPC.
latefinal
childResources Set<Resource>
finalinherited
completionSources Map<String, IOutputCompletionSource>
latefinalinherited
ebsBlockDevices ↔ Output<List<LaunchConfigurationEbsBlockDevice>>
Additional EBS block devices to attach to the instance. See Block Devices below for details.
latefinal
ebsOptimized ↔ Output<bool>
If true, the launched EC2 instance will be EBS-optimized.
latefinal
enableMonitoring ↔ Output<bool?>
Enables/disables detailed monitoring. This is enabled by default.
latefinal
ephemeralBlockDevices ↔ Output<List<LaunchConfigurationEphemeralBlockDevice>?>
Customize Ephemeral (also known as "Instance Store") volumes on the instance. See Block Devices below for details.
latefinal
hashCode int
The hash code for this object.
no setterinherited
iamInstanceProfile ↔ Output<String?>
The name attribute of the IAM instance profile to associate with launched instances.
latefinal
id ↔ Output<String>
getter/setter pairinherited
imageId ↔ Output<String>
The EC2 image ID to launch.
latefinal
instanceType ↔ Output<String>
The size of instance to launch.
latefinal
isCustom bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference bool
Whether this instance represents a resource value returned over RPC.
finalinherited
keyName ↔ Output<String>
The key name that should be used for the instance.
latefinal
metadataOptions ↔ Output<LaunchConfigurationMetadataOptions>
The metadata options for the instance.
latefinal
name ↔ Output<String>
The name of the launch configuration. If you leave this blank, this provider will auto-generate a unique name. Conflicts with namePrefix.
latefinal
namePrefix ↔ Output<String>
Creates a unique name beginning with the specified prefix. Conflicts with name.
latefinal
placementTenancy ↔ Output<String?>
The tenancy of the instance. Valid values are default or dedicated, see AWS's Create Launch Configuration for more details.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
rootBlockDevice ↔ Output<LaunchConfigurationRootBlockDevice>
Customize details about the root block device of the instance. See Block Devices below for details.
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
securityGroups ↔ Output<List<String>?>
A list of associated security group IDS.
latefinal
spotPrice ↔ Output<String?>
The maximum price to use for reserving spot instances.
latefinal
transformations List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
userData ↔ Output<String?>
The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see userDataBase64 instead.
latefinal
userDataBase64 ↔ Output<String?>
Can be used instead of userData to pass base64-encoded binary data directly. Use this instead of userData whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption.
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() String
Returns this resource's logical name.
inherited
getResourceType() String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {LaunchConfigurationState? state, CustomResourceOptions? options}) LaunchConfiguration
Gets an existing LaunchConfiguration resource's state with the given name and id.