ECS class
Amazon Elastic Container Service (Amazon ECS) is a highly scalable, fast, container management service that makes it easy to run, stop, and manage Docker containers on a cluster. You can host your cluster on a serverless infrastructure that is managed by Amazon ECS by launching your services or tasks using the Fargate launch type. For more control, you can host your tasks on a cluster of Amazon Elastic Compute Cloud (Amazon EC2) instances that you manage by using the EC2 launch type. For more information about launch types, see Amazon ECS Launch Types.
Constructors
- ECS.new({required String region, AwsClientCredentials? credentials, AwsClientCredentialsProvider? credentialsProvider, Client? client, String? endpointUrl})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → void - Closes the internal HTTP client if none was provided at creation. If a client was passed as a constructor argument, this becomes a noop.
-
createCapacityProvider(
{required AutoScalingGroupProvider autoScalingGroupProvider, required String name, List< Tag> ? tags}) → Future<CreateCapacityProviderResponse> - Creates a new capacity provider. Capacity providers are associated with an Amazon ECS cluster and are used in capacity provider strategies to facilitate cluster auto scaling.
-
createCluster(
{List< String> ? capacityProviders, String? clusterName, List<CapacityProviderStrategyItem> ? defaultCapacityProviderStrategy, List<ClusterSetting> ? settings, List<Tag> ? tags}) → Future<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 with theCreateCluster
action. -
createService(
{required String serviceName, List< CapacityProviderStrategyItem> ? capacityProviderStrategy, String? clientToken, String? cluster, DeploymentConfiguration? deploymentConfiguration, DeploymentController? deploymentController, int? desiredCount, bool? enableECSManagedTags, int? healthCheckGracePeriodSeconds, LaunchType? launchType, List<LoadBalancer> ? loadBalancers, NetworkConfiguration? networkConfiguration, List<PlacementConstraint> ? placementConstraints, List<PlacementStrategy> ? placementStrategy, String? platformVersion, PropagateTags? propagateTags, String? role, SchedulingStrategy? schedulingStrategy, List<ServiceRegistry> ? serviceRegistries, List<Tag> ? tags, String? taskDefinition}) → Future<CreateServiceResponse> -
Runs and maintains a desired number of tasks from a specified task
definition. If the number of tasks running in a service drops below the
desiredCount
, Amazon ECS runs another copy of the task in the specified cluster. To update an existing service, see the UpdateService action. -
createTaskSet(
{required String cluster, required String service, required String taskDefinition, List< CapacityProviderStrategyItem> ? capacityProviderStrategy, String? clientToken, String? externalId, LaunchType? launchType, List<LoadBalancer> ? loadBalancers, NetworkConfiguration? networkConfiguration, String? platformVersion, Scale? scale, List<ServiceRegistry> ? serviceRegistries, List<Tag> ? tags}) → Future<CreateTaskSetResponse> -
Create a task set in the specified cluster and service. This is used when
a service uses the
EXTERNAL
deployment controller type. For more information, see Amazon ECS Deployment Types in the Amazon Elastic Container Service Developer Guide. -
deleteAccountSetting(
{required SettingName name, String? principalArn}) → Future< DeleteAccountSettingResponse> - Disables an account setting for a specified IAM user, IAM role, or the root user for an account.
-
deleteAttributes(
{required List< Attribute> attributes, String? cluster}) → Future<DeleteAttributesResponse> - Deletes one or more custom attributes from an Amazon ECS resource.
-
deleteCapacityProvider(
{required String capacityProvider}) → Future< DeleteCapacityProviderResponse> -
Deletes the specified capacity provider.
Prior to a capacity provider being deleted, the capacity provider must be
removed from the capacity provider strategy from all services. The
UpdateService API can be used to remove a capacity provider from a
service's capacity provider strategy. When updating a service, the
forceNewDeployment
option can be used to ensure that any tasks using the Amazon EC2 instance capacity provided by the capacity provider are transitioned to use the capacity from the remaining capacity providers. Only capacity providers that are not associated with a cluster can be deleted. To remove a capacity provider from a cluster, you can either use PutClusterCapacityProviders or delete the cluster. -
deleteCluster(
{required String cluster}) → Future< DeleteClusterResponse> -
Deletes the specified cluster. The cluster will transition to the
INACTIVE
state. Clusters with anINACTIVE
status may remain discoverable in your account for a period of time. However, this behavior is subject to change in the future, so you should not rely onINACTIVE
clusters persisting. -
deleteService(
{required String service, String? cluster, bool? force}) → Future< DeleteServiceResponse> - Deletes a specified service within a cluster. You can delete a service if you have no running tasks in it and the desired task count is zero. If the service is actively maintaining tasks, you cannot delete it, and you must update the service to a desired task count of zero. For more information, see UpdateService.
-
deleteTaskSet(
{required String cluster, required String service, required String taskSet, bool? force}) → Future< DeleteTaskSetResponse> -
Deletes a specified task set within a service. This is used when a service
uses the
EXTERNAL
deployment controller type. For more information, see Amazon ECS Deployment Types in the Amazon Elastic Container Service Developer Guide. -
deregisterContainerInstance(
{required String containerInstance, String? cluster, bool? force}) → Future< DeregisterContainerInstanceResponse> - Deregisters an Amazon ECS container instance from the specified cluster. This instance is no longer available to run tasks.
-
deregisterTaskDefinition(
{required String taskDefinition}) → Future< DeregisterTaskDefinitionResponse> -
Deregisters the specified task definition by family and revision. Upon
deregistration, the task definition is marked as
INACTIVE
. Existing tasks and services that reference anINACTIVE
task definition continue to run without disruption. Existing services that reference anINACTIVE
task definition can still scale up or down by modifying the service's desired count. -
describeCapacityProviders(
{List< String> ? capacityProviders, List<CapacityProviderField> ? include, int? maxResults, String? nextToken}) → Future<DescribeCapacityProvidersResponse> - Describes one or more of your capacity providers.
-
describeClusters(
{List< String> ? clusters, List<ClusterField> ? include}) → Future<DescribeClustersResponse> - Describes one or more of your clusters.
-
describeContainerInstances(
{required List< String> containerInstances, String? cluster, List<ContainerInstanceField> ? include}) → Future<DescribeContainerInstancesResponse> - Describes Amazon Elastic Container Service container instances. Returns metadata about registered and remaining resources on each container instance requested.
-
describeServices(
{required List< String> services, String? cluster, List<ServiceField> ? include}) → Future<DescribeServicesResponse> - Describes the specified services running in your cluster.
-
describeTaskDefinition(
{required String taskDefinition, List< TaskDefinitionField> ? include}) → Future<DescribeTaskDefinitionResponse> -
Describes a task definition. You can specify a
family
andrevision
to find information about a specific task definition, or you can simply specify the family to find the latestACTIVE
revision in that family. -
describeTasks(
{required List< String> tasks, String? cluster, List<TaskField> ? include}) → Future<DescribeTasksResponse> - Describes a specified task or tasks.
-
describeTaskSets(
{required String cluster, required String service, List< TaskSetField> ? include, List<String> ? taskSets}) → Future<DescribeTaskSetsResponse> -
Describes the task sets in the specified cluster and service. This is used
when a service uses the
EXTERNAL
deployment controller type. For more information, see Amazon ECS Deployment Types in the Amazon Elastic Container Service Developer Guide. -
discoverPollEndpoint(
{String? cluster, String? containerInstance}) → Future< DiscoverPollEndpointResponse> - May throw ServerException. May throw ClientException.
-
listAccountSettings(
{bool? effectiveSettings, int? maxResults, SettingName? name, String? nextToken, String? principalArn, String? value}) → Future< ListAccountSettingsResponse> - Lists the account settings for a specified principal.
-
listAttributes(
{required TargetType targetType, String? attributeName, String? attributeValue, String? cluster, int? maxResults, String? nextToken}) → Future< ListAttributesResponse> -
Lists the attributes for Amazon ECS resources within a specified target
type and cluster. When you specify a target type and cluster,
ListAttributes
returns a list of attribute objects, one for each attribute on each resource. You can filter the list of results to a single attribute name to only return results that have that name. You can also filter the results by attribute name and value, for example, to see which container instances in a cluster are running a Linux AMI (ecs.os-type=linux
). -
listClusters(
{int? maxResults, String? nextToken}) → Future< ListClustersResponse> - Returns a list of existing clusters.
-
listContainerInstances(
{String? cluster, String? filter, int? maxResults, String? nextToken, ContainerInstanceStatus? status}) → Future< ListContainerInstancesResponse> -
Returns a list of container instances in a specified cluster. You can
filter the results of a
ListContainerInstances
operation with cluster query language statements inside thefilter
parameter. For more information, see Cluster Query Language in the Amazon Elastic Container Service Developer Guide. -
listServices(
{String? cluster, LaunchType? launchType, int? maxResults, String? nextToken, SchedulingStrategy? schedulingStrategy}) → Future< ListServicesResponse> - Lists the services that are running in a specified cluster.
-
listTagsForResource(
{required String resourceArn}) → Future< ListTagsForResourceResponse> - List the tags for an Amazon ECS resource.
-
listTaskDefinitionFamilies(
{String? familyPrefix, int? maxResults, String? nextToken, TaskDefinitionFamilyStatus? status}) → Future< ListTaskDefinitionFamiliesResponse> -
Returns a list of task definition families that are registered to your
account (which may include task definition families that no longer have
any
ACTIVE
task definition revisions). -
listTaskDefinitions(
{String? familyPrefix, int? maxResults, String? nextToken, SortOrder? sort, TaskDefinitionStatus? status}) → Future< ListTaskDefinitionsResponse> -
Returns a list of task definitions that are registered to your account.
You can filter the results by family name with the
familyPrefix
parameter or by status with thestatus
parameter. -
listTasks(
{String? cluster, String? containerInstance, DesiredStatus? desiredStatus, String? family, LaunchType? launchType, int? maxResults, String? nextToken, String? serviceName, String? startedBy}) → Future< ListTasksResponse> -
Returns a list of tasks for a specified cluster. You can filter the
results by family name, by a particular container instance, or by the
desired status of the task with the
family
,containerInstance
, anddesiredStatus
parameters. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
putAccountSetting(
{required SettingName name, required String value, String? principalArn}) → Future< PutAccountSettingResponse> - Modifies an account setting. Account settings are set on a per-Region basis.
-
putAccountSettingDefault(
{required SettingName name, required String value}) → Future< PutAccountSettingDefaultResponse> - Modifies an account setting for all IAM users on an account for whom no individual account setting has been specified. Account settings are set on a per-Region basis.
-
putAttributes(
{required List< Attribute> attributes, String? cluster}) → Future<PutAttributesResponse> - Create or update an attribute on an Amazon ECS resource. If the attribute does not exist, it is created. If the attribute exists, its value is replaced with the specified value. To delete an attribute, use DeleteAttributes. For more information, see Attributes in the Amazon Elastic Container Service Developer Guide.
-
putClusterCapacityProviders(
{required List< String> capacityProviders, required String cluster, required List<CapacityProviderStrategyItem> defaultCapacityProviderStrategy}) → Future<PutClusterCapacityProvidersResponse> - Modifies the available capacity providers and the default capacity provider strategy for a cluster.
-
registerContainerInstance(
{List< Attribute> ? attributes, String? cluster, String? containerInstanceArn, String? instanceIdentityDocument, String? instanceIdentityDocumentSignature, List<PlatformDevice> ? platformDevices, List<Tag> ? tags, List<Resource> ? totalResources, VersionInfo? versionInfo}) → Future<RegisterContainerInstanceResponse> - May throw ServerException. May throw ClientException. May throw InvalidParameterException.
-
registerTaskDefinition(
{required List< ContainerDefinition> containerDefinitions, required String family, String? cpu, String? executionRoleArn, List<InferenceAccelerator> ? inferenceAccelerators, IpcMode? ipcMode, String? memory, NetworkMode? networkMode, PidMode? pidMode, List<TaskDefinitionPlacementConstraint> ? placementConstraints, ProxyConfiguration? proxyConfiguration, List<Compatibility> ? requiresCompatibilities, List<Tag> ? tags, String? taskRoleArn, List<Volume> ? volumes}) → Future<RegisterTaskDefinitionResponse> -
Registers a new task definition from the supplied
family
andcontainerDefinitions
. Optionally, you can add data volumes to your containers with thevolumes
parameter. For more information about task definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon Elastic Container Service Developer Guide. -
runTask(
{required String taskDefinition, List< CapacityProviderStrategyItem> ? capacityProviderStrategy, String? cluster, int? count, bool? enableECSManagedTags, String? group, LaunchType? launchType, NetworkConfiguration? networkConfiguration, TaskOverride? overrides, List<PlacementConstraint> ? placementConstraints, List<PlacementStrategy> ? placementStrategy, String? platformVersion, PropagateTags? propagateTags, String? referenceId, String? startedBy, List<Tag> ? tags}) → Future<RunTaskResponse> - Starts a new task using the specified task definition.
-
startTask(
{required List< String> containerInstances, required String taskDefinition, String? cluster, bool? enableECSManagedTags, String? group, NetworkConfiguration? networkConfiguration, TaskOverride? overrides, PropagateTags? propagateTags, String? referenceId, String? startedBy, List<Tag> ? tags}) → Future<StartTaskResponse> - Starts a new task from the specified task definition on the specified container instance or instances.
-
stopTask(
{required String task, String? cluster, String? reason}) → Future< StopTaskResponse> - Stops a running task. Any tags associated with the task will be deleted.
-
submitAttachmentStateChanges(
{required List< AttachmentStateChange> attachments, String? cluster}) → Future<SubmitAttachmentStateChangesResponse> - May throw ServerException. May throw ClientException. May throw AccessDeniedException. May throw InvalidParameterException.
-
submitContainerStateChange(
{String? cluster, String? containerName, int? exitCode, List< NetworkBinding> ? networkBindings, String? reason, String? runtimeId, String? status, String? task}) → Future<SubmitContainerStateChangeResponse> - May throw ServerException. May throw ClientException. May throw AccessDeniedException.
-
submitTaskStateChange(
{List< AttachmentStateChange> ? attachments, String? cluster, List<ContainerStateChange> ? containers, DateTime? executionStoppedAt, DateTime? pullStartedAt, DateTime? pullStoppedAt, String? reason, String? status, String? task}) → Future<SubmitTaskStateChangeResponse> - May throw ServerException. May throw ClientException. May throw AccessDeniedException. May throw InvalidParameterException.
-
tagResource(
{required String resourceArn, required List< Tag> tags}) → Future<void> -
Associates the specified tags to a resource with the specified
resourceArn
. If existing tags on a resource are not specified in the request parameters, they are not changed. When a resource is deleted, the tags associated with that resource are deleted as well. -
toString(
) → String -
A string representation of this object.
inherited
-
untagResource(
{required String resourceArn, required List< String> tagKeys}) → Future<void> - Deletes specified tags from a resource.
-
updateCapacityProvider(
{required AutoScalingGroupProviderUpdate autoScalingGroupProvider, required String name}) → Future< UpdateCapacityProviderResponse> - Modifies the parameters for a capacity provider.
-
updateClusterSettings(
{required String cluster, required List< ClusterSetting> settings}) → Future<UpdateClusterSettingsResponse> - Modifies the settings to use for a cluster.
-
updateContainerAgent(
{required String containerInstance, String? cluster}) → Future< UpdateContainerAgentResponse> - Updates the Amazon ECS container agent on a specified container instance. Updating the Amazon ECS container agent does not interrupt running tasks or services on the container instance. The process for updating the agent differs depending on whether your container instance was launched with the Amazon ECS-optimized AMI or another operating system.
-
updateContainerInstancesState(
{required List< String> containerInstances, required ContainerInstanceStatus status, String? cluster}) → Future<UpdateContainerInstancesStateResponse> - Modifies the status of an Amazon ECS container instance.
-
updateService(
{required String service, List< CapacityProviderStrategyItem> ? capacityProviderStrategy, String? cluster, DeploymentConfiguration? deploymentConfiguration, int? desiredCount, bool? forceNewDeployment, int? healthCheckGracePeriodSeconds, NetworkConfiguration? networkConfiguration, List<PlacementConstraint> ? placementConstraints, List<PlacementStrategy> ? placementStrategy, String? platformVersion, String? taskDefinition}) → Future<UpdateServiceResponse> -
For services using the rolling update (
ECS
) deployment controller, the desired count, deployment configuration, network configuration, task placement constraints and strategies, or task definition used can be updated. -
updateServicePrimaryTaskSet(
{required String cluster, required String primaryTaskSet, required String service}) → Future< UpdateServicePrimaryTaskSetResponse> -
Modifies which task set in a service is the primary task set. Any
parameters that are updated on the primary task set in a service will
transition to the service. This is used when a service uses the
EXTERNAL
deployment controller type. For more information, see Amazon ECS Deployment Types in the Amazon Elastic Container Service Developer Guide. -
updateTaskSet(
{required String cluster, required Scale scale, required String service, required String taskSet}) → Future< UpdateTaskSetResponse> -
Modifies a task set. This is used when a service uses the
EXTERNAL
deployment controller type. For more information, see Amazon ECS Deployment Types in the Amazon Elastic Container Service Developer Guide.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited