createCluster

inline suspend fun EcsClient.createCluster(crossinline block: CreateClusterRequest.Builder.() -> Unit): CreateClusterResponse

Creates a new Amazon ECS cluster. By default, your account receives a default cluster when you launch your first container instance. However, you can create your own cluster with a unique name.

When you call the CreateCluster API operation, Amazon ECS attempts to create the Amazon ECS service-linked role for your account. This is so that it can manage required resources in other Amazon Web Services services on your behalf. However, if the user that makes the call doesn't have permissions to create the service-linked role, it isn't created. For more information, see Using service-linked roles for Amazon ECS in the Amazon Elastic Container Service Developer Guide.

Samples


fun main() { 
   //sampleStart 
   // This example creates a cluster in your default region.
val resp = ecsClient.createCluster {
    clusterName = "my_cluster"
} 
   //sampleEnd
}