POSThttps://api.spotinst.io/ocean/aws/ecs/cluster/fargate/import?accountId={ACCOUNT_ID}

This API copies the configuration from a Fargate service into the corresponding fields of an Ocean object. (This process is commonly referred to as importing.) The API returns an Ocean object that is suitable for use in the Create API to create a new Ocean cluster based on your Fargate configuration.

If you are migrating a Fargate service that has tags, you must run the Opt In procedure on your Amazon account or IAM role. This is required in order to obtain the necessary Amazon Resource Name (ARN) and resource ID format for your ECS tasks, container instances, and services. For more information about the required ARN and the Opt In procedure, see the following pages:

The API requires one of the following permissions to be defined in Spot:

URL Parameters

Parameter Type Description
ACCOUNT_ID * String

The Spot accountId associated with your token.

Example: act-123abc
Request

Headers
Copied!
Downloaded!
{
    "Authorization": "Bearer ${token}",
    "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
    "oceanClusterName": "fargate-import-ocean",
    "ecsClusterName": "fargateTestCluster",
    "region": "us-west-1",
    "services": [
        "service_app1"
    ],
    "keyPair": "spot-prod",
    "tags": [
        {
            "tagKey": "env",
            "tagValue": "prod"
        }
    ]
}
Attribute Type Description
oceanClusterName * String

Name of the cluster in new Ocean object.

Example: fargate-import-ocean
ecsClusterName * String

Name of the cluster in ECS.

Example: fargateTestCluster
region * String

Name of the AWS region the ECS cluster is in.

Example: us-west-1
services * Array<String>

Name of the ECS Fargate service to be imported.

keyPair String

Specify a Key Pair to attach to the services.

Example: spot-prod
tags Array<Object>

Set tags for the service. Items should be unique.

tags.tagKey String

The tag's key.

Example: env
tags.tagValue String

The tag's name.

Example: prod
Response

Body
Copied!
Downloaded!
{
    "items": [
        {
            "cluster": {
                "name": "fargate-import-ocean",
                "clusterName": "fargateTestCluster",
                "region": "us-west-2",
                "compute": {
                    "subnetIds": [
                        "subnet-00c12878",
                        "subnet-3426551f"
                    ],
                    "launchSpecification": {
                        "imageId": "ami-066300e430fac9278",
                        "securityGroupIds": [
                            "sg-02d74a8ffe0fbeb52",
                            "sg-02422b0e6b9c18dec"
                        ],
                        "iamInstanceProfile": {
                            "arn": "arn:aws:iam::109311601880:instance-profile/ecsInstanceRole"
                        },
                        "userData": "IyEvYmluL2Jhc2gKZWNobyBFQ1NfQ0xVU1RFUj1mYXJnYXRlVGVzdENsdXN0ZXIgPj4gL2V0Yy9lY3MvZWNzLmNvbmZpZztlY2hvIEVDU19CQUNLRU5EX0hPU1Q9ID4+IC9ldGMvZWNzL2Vjcy5jb25maWc7",
                        "keyPair": "spot-prod",
                        "tags": [
                            {
                                "tagKey": "env",
                                "tagValue": "prod"
                            }
                        ]
                    }
                }
            }
        }
    ]
}