This page demonstrates how to create an Ocean ECS Custom Launch Specification resource using the Spotinst Terraform plugin.

This post assumes that you already have a Spotinst account and went through Spotinst Terraform Installation & Configuration

Example Usage – Ocean ECS Launch Specification
resource "spotinst_ocean_ecs_launch_spec" "example" {
  ocean_id  = "o-123456"
  name      = "customLaunchSpec"
  image_id  = "ami-123456"
  user_data = "echo hello world"
  iam_instance_profile = "iam-profile"
  security_group_ids = ["awseb-12345"]
  attributes {
    key   = "fakeKey"
    value = "fakeValue"


Argument Reference

ocean_id * String

The Ocean cluster ID.

Example: o-123456
name * String

The Ocean Launch Specification name.

Example: customLaunchSpec
image_id String

ID of the image used to launch the instances.

user_data String

Base64-encoded MIME user data to make available to the instances.

Example: echo hello world
iam_instance_profile String

The ARN or name of an IAM instance profile to associate with launched instances.

Example: iam-profile
security_group_ids Array<String>

One or more security group IDs.

Example: ["sg-12345"]
attributes Object

Optionally adds labels to instances launched in an Ocean cluster.

attributes.key * String

The label key.

Example: fakeKey
attributes.value * String

The label value.

Example: fakeValue