Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . ec2 ]

create-launch-template

Description

Creates a launch template. A launch template contains the parameters to launch an instance. When you launch an instance using run-instances , you can specify a launch template instead of providing the launch parameters in the request.

See also: AWS API Documentation

Synopsis

  create-launch-template
[--dry-run | --no-dry-run]
[--client-token <value>]
--launch-template-name <value>
[--version-description <value>]
--launch-template-data <value>
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--dry-run | --no-dry-run (boolean)

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .

--client-token (string)

Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency .

--launch-template-name (string)

A name for the launch template.

--version-description (string)

A description for the first version of the launch template.

--launch-template-data (structure)

The information for the launch template.

JSON Syntax:

{
  "KernelId": "string",
  "EbsOptimized": true|false,
  "IamInstanceProfile": {
    "Arn": "string",
    "Name": "string"
  },
  "BlockDeviceMappings": [
    {
      "DeviceName": "string",
      "VirtualName": "string",
      "Ebs": {
        "Encrypted": true|false,
        "DeleteOnTermination": true|false,
        "Iops": integer,
        "KmsKeyId": "string",
        "SnapshotId": "string",
        "VolumeSize": integer,
        "VolumeType": "standard"|"io1"|"gp2"|"sc1"|"st1"
      },
      "NoDevice": "string"
    }
    ...
  ],
  "NetworkInterfaces": [
    {
      "AssociatePublicIpAddress": true|false,
      "DeleteOnTermination": true|false,
      "Description": "string",
      "DeviceIndex": integer,
      "Groups": ["string", ...],
      "Ipv6AddressCount": integer,
      "Ipv6Addresses": [
        {
          "Ipv6Address": "string"
        }
        ...
      ],
      "NetworkInterfaceId": "string",
      "PrivateIpAddress": "string",
      "PrivateIpAddresses": [
        {
          "Primary": true|false,
          "PrivateIpAddress": "string"
        }
        ...
      ],
      "SecondaryPrivateIpAddressCount": integer,
      "SubnetId": "string"
    }
    ...
  ],
  "ImageId": "string",
  "InstanceType": "t1.micro"|"t2.nano"|"t2.micro"|"t2.small"|"t2.medium"|"t2.large"|"t2.xlarge"|"t2.2xlarge"|"m1.small"|"m1.medium"|"m1.large"|"m1.xlarge"|"m3.medium"|"m3.large"|"m3.xlarge"|"m3.2xlarge"|"m4.large"|"m4.xlarge"|"m4.2xlarge"|"m4.4xlarge"|"m4.10xlarge"|"m4.16xlarge"|"m2.xlarge"|"m2.2xlarge"|"m2.4xlarge"|"cr1.8xlarge"|"r3.large"|"r3.xlarge"|"r3.2xlarge"|"r3.4xlarge"|"r3.8xlarge"|"r4.large"|"r4.xlarge"|"r4.2xlarge"|"r4.4xlarge"|"r4.8xlarge"|"r4.16xlarge"|"x1.16xlarge"|"x1.32xlarge"|"x1e.xlarge"|"x1e.2xlarge"|"x1e.4xlarge"|"x1e.8xlarge"|"x1e.16xlarge"|"x1e.32xlarge"|"i2.xlarge"|"i2.2xlarge"|"i2.4xlarge"|"i2.8xlarge"|"i3.large"|"i3.xlarge"|"i3.2xlarge"|"i3.4xlarge"|"i3.8xlarge"|"i3.16xlarge"|"hi1.4xlarge"|"hs1.8xlarge"|"c1.medium"|"c1.xlarge"|"c3.large"|"c3.xlarge"|"c3.2xlarge"|"c3.4xlarge"|"c3.8xlarge"|"c4.large"|"c4.xlarge"|"c4.2xlarge"|"c4.4xlarge"|"c4.8xlarge"|"c5.large"|"c5.xlarge"|"c5.2xlarge"|"c5.4xlarge"|"c5.9xlarge"|"c5.18xlarge"|"cc1.4xlarge"|"cc2.8xlarge"|"g2.2xlarge"|"g2.8xlarge"|"g3.4xlarge"|"g3.8xlarge"|"g3.16xlarge"|"cg1.4xlarge"|"p2.xlarge"|"p2.8xlarge"|"p2.16xlarge"|"p3.2xlarge"|"p3.8xlarge"|"p3.16xlarge"|"d2.xlarge"|"d2.2xlarge"|"d2.4xlarge"|"d2.8xlarge"|"f1.2xlarge"|"f1.16xlarge"|"m5.large"|"m5.xlarge"|"m5.2xlarge"|"m5.4xlarge"|"m5.12xlarge"|"m5.24xlarge"|"h1.2xlarge"|"h1.4xlarge"|"h1.8xlarge"|"h1.16xlarge",
  "KeyName": "string",
  "Monitoring": {
    "Enabled": true|false
  },
  "Placement": {
    "AvailabilityZone": "string",
    "Affinity": "string",
    "GroupName": "string",
    "HostId": "string",
    "Tenancy": "default"|"dedicated"|"host",
    "SpreadDomain": "string"
  },
  "RamDiskId": "string",
  "DisableApiTermination": true|false,
  "InstanceInitiatedShutdownBehavior": "stop"|"terminate",
  "UserData": "string",
  "TagSpecifications": [
    {
      "ResourceType": "customer-gateway"|"dhcp-options"|"image"|"instance"|"internet-gateway"|"network-acl"|"network-interface"|"reserved-instances"|"route-table"|"snapshot"|"spot-instances-request"|"subnet"|"security-group"|"volume"|"vpc"|"vpn-connection"|"vpn-gateway",
      "Tags": [
        {
          "Key": "string",
          "Value": "string"
        }
        ...
      ]
    }
    ...
  ],
  "ElasticGpuSpecifications": [
    {
      "Type": "string"
    }
    ...
  ],
  "SecurityGroupIds": ["string", ...],
  "SecurityGroups": ["string", ...],
  "InstanceMarketOptions": {
    "MarketType": "spot",
    "SpotOptions": {
      "MaxPrice": "string",
      "SpotInstanceType": "one-time"|"persistent",
      "BlockDurationMinutes": integer,
      "ValidUntil": timestamp,
      "InstanceInterruptionBehavior": "hibernate"|"stop"|"terminate"
    }
  },
  "CreditSpecification": {
    "CpuCredits": "string"
  }
}

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

Output

LaunchTemplate -> (structure)

Information about the launch template.

LaunchTemplateId -> (string)

The ID of the launch template.

LaunchTemplateName -> (string)

The name of the launch template.

CreateTime -> (timestamp)

The time launch template was created.

CreatedBy -> (string)

The principal that created the launch template.

DefaultVersionNumber -> (long)

The version number of the default version of the launch template.

LatestVersionNumber -> (long)

The version number of the latest version of the launch template.

Tags -> (list)

The tags for the launch template.

(structure)

Describes a tag.

Key -> (string)

The key of the tag.

Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws:

Value -> (string)

The value of the tag.

Constraints: Tag values are case-sensitive and accept a maximum of 255 Unicode characters.