Launch templates#

General information#

Launch templates specify instance configuration information and help reduce the number of steps and actions to create an instance. In particular, launch templates are used to describe the configuration of instances you want to launch in Auto Scaling Groups.

To avoid setting the same parameters every time you launch a similar instance, you can save them in a launch template. For example, you can select the image from which an instance is typically created, specify the instance type, add user data, set network and other parameters. When launching an instance from a template, these parameters will be applied automatically.

For each launch template, you can create its versions with different instance parameters. When launching an instance from a template, you can choose any of its versions. If the version is not explicitly specified, the default version is used. When creating a template, the first version is created and set as default. Subsequently, you can set any of the template versions as default.

Versioning works well with automation tools. For example, you need to run a more powerful machine to accommodate an increased application load, and you create an instance using the default version of a launch template. You can create a new version of the launch template with the desired instance type and set it as default. The template ID will remain the same and no changes to the automation code itself will be required.

Note

You can create up to 50 launch templates in each project and up to 100 versions of each template. To increase the limits, leave a request on the support portal or write to support@ngn.com.tr.

Creating a launch template#

When creating a launch template, you can specify all or only a part of the parameters that will be used when creating an instance from this template. If required, the specified parameters can be changed when creating an instance.

The creation procedure for a launch template is similar to that for an instance, with a few exceptions. Below, only the main template creation steps and differences are described. To learn more about the selection and meaning of particular parameters, see the instance creation procedure description.

To create a launch template, go to the respective section and click Create.

Step 1. Select an image#

From the list of images, select the pre-built OS image you want to use to create the instance and click Select.

Note

If the desired image is absent from the available images, click Create a new image. Then you are automatically forwarded to the Images section. Create the desired image according to the instruction. You will have to start the template creation procedure from the beginning. Therefore, it is better to prepare the image in advance.

Step 2. Select an instance placement#

At this step, you need to select where in the cloud the instance will be placed.

  • Placement group.

  • Placement type — If the default value (Shared server) is selected, instances will be started on a shared computing node where instances of other users can also run. For parameters of the launch template for starting instances on a dedicated host, see the documentation for dedicated hosts.

Step 3. Select an instance type.#

Select the instance type with the required vCPU count and RAM size from the list and click Select to proceed to the next step.

Step 4. Specify template and instance parameters#

At this step, specify the launch template name and (optionally) its version description.

Note

The template name can contain ASCII characters only, and its length cannot be less than 3 and more than 128 characters. Version description cannot contain more than 256 characters.

To set network parameters, specify the VPC where the corresponding network resources will be located. You must also select the type of network settings you want to configure: Security Groups or Advanced Network Configuration. This choice determines which network parameters can be configured in the launch template.

Note

VPC is not saved in the launch template explicitly: this parameter is only used to filter available network resources when creating the template.

If the Security Groups option is selected, you can specify up to 5 security groups. They will be assigned to the primary network interface when an instance is created from the template. If no security group is selected, then the default security group will be added to the launch template.

If you select the Advanced network configuration option, you can specify the subnet the primary network interface will be attached to and additional network parameters in the next step. The specified network interface parameters are ignored when instances are to be created in the Auto Scaling Group, so we recommend to use this option only when you plan to create individual instances from the template.

In addition, you can also specify:

  • SSH-key

  • user data

If you want instances created from a template to be automatically deleted upon shutdown, set the Delete on instance shutdown flag.

Then, you can proceed directly to viewing the selected instance configuration, which will be written to the template. To do this, click Overview and create. If you want to make configuration more specific by describing attached devices (for example, network interface parameters), click Next.

Step 5. Specify network interface parameters#

At this step, you can add the necessary network interfaces and set their parameters.

Note

This step is available only if the Advanced network configuration option was selected in the previous step.

You can select an existing or new network interface as the primary one. The primary interface is attached to the network that was selected in the previous step. For the new interface, you can specify:

  • description

  • private IP

  • security groups

If you want the interface to be automatically deleted, along with the instance, check the Delete with instance checkbox. To assign an external IP address to the interface, check the Associate with existing Elastic IP checkbox. For details, read about network interface parameters.

Attention

If you select the existing network interface, then an error will occur when you try to create another instance from this launch template. The reason: the interface will already be used by the previously created instance. Specifying an existing interface in a launch template makes sense, for example, when only one instance is to be launched periodically from this template during business hours and deleted at the end of the business day.

To configure additional interfaces, click Add device. For each of them, you can specify a network to which it will be attached and set the same parameters as for the primary interface. However, you cannot assign Elastic IPs to additional network interfaces in the instance wizard. If necessary, this can be done manually later.

Once you have set the interface parameters, you can proceed to the template configuration overview or go to the next step. In the former case, click Overview and create; in the latter, click Next.

Step 6. Set parameters of the volumes to attach#

In this step, you can set parameters of the volumes that will be created together with the instance.

For each volume you want to attach, you can select:

  • volume snapshot from which it will be created

  • volume size

  • volume type

  • IOPS

  • throughput (if applicable for the selected volume type)

If you want the volume to be automatically deleted, along with the instance, check the Delete with instance checkbox. For details, read about volume parameters.

To add a volume, click Add volume and set its parameters.

Once you have set the volume parameters, you can proceed to the template configuration overview or go to the next step. In the former case, click Overview and create; in the latter, click Next.

Step 7. Add tags#

In this step, you can assign tags to the launch template, instances, and/or volumes. To assign the Name tag, click Add Name tag; to assign an arbitrary tag, click Add tag.

Set the tag key and value (for the Name tag, the key is already set). You can select resources (template, instances, and/or volumes) to which a tag is to be assigned. To this end, check the appropriate checkboxes. For each tag, at least one checkbox must be checked. By default, a tag is assigned to a template only.

To specify additional tags, click Add tag. After setting the required tags, click Overview and Create.

Step 8. Review parameters#

In the Overview step, check the template configuration and click Create.

Using template versions#

Once created, a launch template cannot be modified. Instead, you can create a version of the template and change and/or add the parameters you need.

Template versions are numbered in the order they are created. Version 1 is that created along with the launch template.

You can set a default version and delete those you no longer need.

Create a launch template version#

To create a launch template version, go to the template page. To do this, in the Launch Templates section, find the desired template in the table and click its ID. In the Information tab, you can specify the version from which the next version will be created. To this end, select the desired version by its number and description in the version selector and click Create new version.

Note

We recommend that you always add a version description to facilitate further search. Otherwise, you will have to remember the number of the version that contains the desired instance configuration.

The launch template version wizard contains the same steps as the launch template wizard. But it opens in the Parameters step. If you need to change the instance type or the image from which the instance will be created, then go back a step or two by clicking Back.

In any step, you can change any parameter values and set parameter values that were not previously specified. However, the values of the parameters you set earlier cannot be left blank.

Note

Tags can be assigned to a template, but not a version; therefore, in the Tags step, you can assign tags to instances or volumes only.

Change the default version#

The default version is used if no particular version is specified when creating an instance from a template. To set a default version:

  • go to the Information tab on the template page

  • in the version selector, select the version you want to set as the default version

  • click Set version as default

Delete a launch template version#

Template versions are deleted permanently. A newly created version cannot be assigned the number of the deleted version. It will be assigned the next serial number. To delete a template version:

  • go to the Information tab on the template page

  • in the version selector, select the version you want to delete;

  • click Delete version.

Attention

You cannot delete the default version. If a version you want to delete is the default one, set another default version first.

Launching an instance from a template#

Launch templates are used when creating instances within Auto Scaling Groups. But you can also use launch templates to create individual instances with specific configuration.

Note

The cloud checks whether resources required to create an instance are available only when the launch template is used. If the resources specified in the launch template are unavailable, the instance creation will fail. For example, if the image specified in the template is no longer available, an error will occur when creating an instance.

Note

To create an instance from a launch template with a security group other than that from the default VPC, you must additionally specify SubnetID.

  1. Go to the Launch Templates section and select the desired launch template in the table.

  2. Click Create instance.

  3. In the dialog window, select the launch template version or use the default one.

  4. Specify the number of instances to be launched.

  5. If necessary, change the instance type and the Name tag, as well as the resources which the Name tag is assigned to.

  6. Once the parameters are set, click Overview and Launch and check the instance configuration.

  7. Click Launch.

You can also create an instance on the template page in the Information tab or in the Instances section. In addition, instances can be launched from a template using an API method RunInstances. This method allows you to change any instance parameters, not only its type and Name tag.

Managing launch templates#

Assign tags to a launch template#

If you didn’t assign tags when creating a template, you can do it later. To do it:

  • go to the Launch templates section

  • select the desired launch template in the table

  • click Customize tags

  • in the dialog window, set tag keys and values

  • to confirm changes, click Apply

Delete launch template#

A launch template you no longer need can be deleted. All template versions will be deleted along with the template. To delete a launch template:

  • go to the Launch templates section

  • select the template you no longer need in the table

  • Click Delete.

  • confirm deletion. Be careful: a deleted launch template cannot be restored.

Information about a launch template versions#

To view information about a launch template version, go to the respective section. Click the link with the ID in the launch template table to open the page of the selected resource. Here you will find details of the selected launch template version configuration. The launch template version can be selected in the version selector.

The Information tab contains the launch template version description and creation time, as well as configuration details of the instance that will be created, such as source image, instance type, placement group, and SSH key. In this tab, you can create a new template version, set the default version, delete the version you no longer need, and also create an instance from the launch template.

The Volumes tab displays parameters of the volumes that will be attached to the instance at its creation: the snapshot from which the volume will be created, its size, type, and the value of the option Delete with instance.

Data in the Network and Security tab depends on the option you selected when creating the launch template in the Parameters step: Security groups or Advanced network configuration. Selecting the former option displays information about the network groups that will be assigned to the primary interface of the instance: group ID and name, description, and Name tag. Selecting the latter option displays information about the network interfaces to be attached to the instance: device index, interface description, subnet where it is created, Elastic IP, Private IP, and the value of the Delete with instance option.

The Resource Tags tab contains keys and values of the assigned tags and specifies resources (instances and/or volumes) to which tags will be assigned.