# This file is automatically generated by botocraft. Do not edit directly.
# mypy: disable-error-code="index, override, assignment, union-attr, misc"
from botocraft.mixins.ecs import ecs_task_definition_include_tags
from botocraft.mixins.ecs import ExpressGatewayServiceManagerMixin
from botocraft.services.ec2 import Instance, InstanceManager
from .abstract import (
Boto3Model,
ReadonlyBoto3Model,
PrimaryBoto3Model,
ReadonlyPrimaryBoto3Model,
Boto3ModelManager,
ReadonlyBoto3ModelManager,
)
from .abstract import PrimaryBoto3ModelQuerySet
from botocraft.mixins.ecs import ecs_task_definition_delete_all
from datetime import datetime
import builtins
from botocraft.mixins.ecs import ServiceRevisionManagerMixin
from botocraft.mixins.ecs import DaemonManagerMixin
from botocraft.mixins.ecs import ecs_service_deployments_only
from botocraft.mixins.ecs import ECSServiceModelMixin
from botocraft.mixins.ecs import ecs_container_instances_only
from botocraft.mixins.ecs import ecs_task_populate_taskDefinition
from typing import ClassVar, Literal, Any, cast
from botocraft.mixins.ecs import ecs_tasks_only
from botocraft.mixins.ecs import CapacityProviderManagerMixin
from botocraft.mixins.ecs import ECSServiceManagerMixin
from botocraft.mixins.ecs import TaskDefinitionModelMixin
from botocraft.services.ecr import ImageIdentifier
from botocraft.mixins.ecs import ecs_services_only
from botocraft.mixins.ecs import ECSContainerInstanceModelMixin
from botocraft.mixins.ecs import ecs_clusters_only
from botocraft.services.ec2 import NetworkInterface
from botocraft.mixins.ecs import DaemonDeploymentManagerMixin
from botocraft.services.elbv2 import TargetGroup, TargetGroupManager
from botocraft.mixins.ecs import DaemonTaskDefinitionManagerMixin
from functools import cached_property
from pydantic import Field
from botocraft.services.ecr import ECRImage, ECRImageManager
from collections import OrderedDict
from botocraft.mixins.tags import TagsDictMixin
from botocraft.mixins.ecs import TaskDefinitionManagerMixin
from botocraft.mixins.ecs import ecs_task_definitions_only
from botocraft.mixins.ecs import ecs_task_populate_taskDefinitions
from botocraft.services.application_autoscaling import (
ScalableTarget,
ScalableTargetManager,
)
from botocraft.mixins.ecs import TaskSetManagerMixin
# ===============
# Managers
# ===============
[docs]class CapacityProviderManager(CapacityProviderManagerMixin, Boto3ModelManager):
service_name: str = "ecs"
[docs] def create(self, model: "CapacityProvider") -> "CapacityProvider":
"""
Creates a capacity provider. Capacity providers are associated with a cluster
and are used in capacity provider strategies to facilitate cluster auto scaling.
You can create capacity providers for Amazon ECS Managed Instances and EC2
instances. Fargate has the predefined ``FARGATE`` and ``FARGATE_SPOT`` capacity
providers.
Args:
model: The :py:class:`CapacityProvider` to create.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
name=data.get("name"),
cluster=data.get("cluster"),
autoScalingGroupProvider=data.get("autoScalingGroupProvider"),
managedInstancesProvider=data.get("managedInstancesProvider"),
tags=data.get("tags"),
)
_response = self.client.create_capacity_provider(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateCapacityProviderResponse(**_response)
self.sessionize(response.capacityProvider)
return cast("CapacityProvider", response.capacityProvider)
[docs] def get(
self,
capacityProvider: str,
*,
cluster: "str | None" = None,
include: "builtins.list[Literal['TAGS']] | None" = None,
) -> "CapacityProvider | None":
"""
Describes one or more of your capacity providers.
Args:
capacityProvider: The short name or full Amazon Resource Name (ARN) of the capacity provider to describe.
Keyword Args:
cluster: The name of the cluster to describe capacity providers for. When specified, only capacity providers
associated with this cluster are returned, including Amazon ECS Managed Instances capacity providers.
include: Specifies whether or not you want to see the resource tags for the capacity provider. If ``TAGS`` is
specified, the tags are included in the response. If this field is omitted, tags aren't included in the response.
"""
args: dict[str, Any] = dict(
capacityProviders=self.serialize([capacityProvider]),
cluster=self.serialize(cluster),
include=self.serialize(include),
)
_response = self.client.describe_capacity_providers(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeCapacityProvidersResponse(**_response)
if response and response.capacityProviders:
self.sessionize(response.capacityProviders[0])
return response.capacityProviders[0]
return None
[docs] def get_many(
self,
*,
capacityProviders: "builtins.list[str] | None" = None,
cluster: "str | None" = None,
include: "builtins.list[Literal['TAGS']] | None" = None,
maxResults: "int | None" = None,
nextToken: "str | None" = None,
) -> "PrimaryBoto3ModelQuerySet | DescribeCapacityProvidersResponse | None":
"""
Describes one or more of your capacity providers.
Keyword Args:
capacityProviders: The short name or full Amazon Resource Name (ARN) of one or more capacity providers. Up to
``100`` capacity providers can be described in an action.
cluster: The name of the cluster to describe capacity providers for. When specified, only capacity providers
associated with this cluster are returned, including Amazon ECS Managed Instances capacity providers.
include: Specifies whether or not you want to see the resource tags for the capacity provider. If ``TAGS`` is
specified, the tags are included in the response. If this field is omitted, tags aren't included in the response.
maxResults: The maximum number of account setting results returned by ``DescribeCapacityProviders`` in paginated
output. When this parameter is used, ``DescribeCapacityProviders`` only returns ``maxResults`` results in a single
page along with a ``nextToken`` response element. The remaining results of the initial request can be seen by
sending another ``DescribeCapacityProviders`` request with the returned ``nextToken`` value. This value can be
between 1 and 10. If this parameter is not used, then ``DescribeCapacityProviders`` returns up to 10 results and a
``nextToken`` value if applicable.
nextToken: The ``nextToken`` value returned from a previous paginated ``DescribeCapacityProviders`` request where
``maxResults`` was used and the results exceeded the value of that parameter. Pagination continues from the end of
the previous results that returned the ``nextToken`` value.
"""
args: dict[str, Any] = dict(
capacityProviders=self.serialize(capacityProviders),
cluster=self.serialize(cluster),
include=self.serialize(include),
maxResults=self.serialize(maxResults),
nextToken=self.serialize(nextToken),
)
_response = self.client.describe_capacity_providers(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeCapacityProvidersResponse(**_response)
if response.capacityProviders:
self.sessionize(response.capacityProviders)
return PrimaryBoto3ModelQuerySet(response.capacityProviders)
return PrimaryBoto3ModelQuerySet([])
[docs] def update(self, model: "CapacityProvider") -> "CapacityProvider":
"""
Modifies the parameters for a capacity provider.
Args:
model: The :py:class:`CapacityProvider` to update.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
name=data.get("name"),
cluster=data.get("cluster"),
autoScalingGroupProvider=data.get("autoScalingGroupProvider"),
managedInstancesProvider=data.get("managedInstancesProvider"),
)
_response = self.client.update_capacity_provider(
**{k: v for k, v in args.items() if v is not None}
)
response = UpdateCapacityProviderResponse(**_response)
self.sessionize(response.capacityProvider)
return cast("CapacityProvider", response.capacityProvider)
[docs] def delete(
self, capacityProvider: str, *, cluster: "str | None" = None
) -> "CapacityProvider":
"""
Deletes the specified capacity provider.
Args:
capacityProvider: The short name or full Amazon Resource Name (ARN) of the capacity provider to delete.
Keyword Args:
cluster: The name of the cluster that contains the capacity provider to delete. Managed instances capacity providers
are cluster- scoped and can only be deleted from their associated cluster.
"""
args: dict[str, Any] = dict(
capacityProvider=self.serialize(capacityProvider),
cluster=self.serialize(cluster),
)
_response = self.client.delete_capacity_provider(
**{k: v for k, v in args.items() if v is not None}
)
response = DeleteCapacityProviderResponse(**_response)
return cast("CapacityProvider", response.capacityProvider)
[docs]class ServiceManager(ECSServiceManagerMixin, Boto3ModelManager):
service_name: str = "ecs"
[docs] def create(
self,
model: "Service",
clientToken: "str | None" = None,
serviceConnectConfiguration: "ServiceConnectConfiguration | None" = None,
volumeConfigurations: "builtins.list[ServiceVolumeConfiguration] | None" = None,
vpcLatticeConfigurations: "builtins.list[VpcLatticeConfiguration] | None" = None,
) -> "Service":
"""
Create an ECS service.
Args:
model: The :py:class:`Service` to create.
Keyword Args:
clientToken: An identifier that you provide to ensure the idempotency of the request. It must be unique and is case
sensitive. Up to 36 ASCII characters in the range of 33-126 (inclusive) are allowed.
serviceConnectConfiguration: The configuration for this service to discover and connect to services, and be
discovered by, and connected from, other services within a namespace.
volumeConfigurations: The configuration for a volume specified in the task definition as a volume that is configured
at launch time. Currently, the only supported volume type is an Amazon EBS volume.
vpcLatticeConfigurations: The VPC Lattice configuration for the service being created.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
serviceName=data.get("serviceName"),
cluster=data.get("clusterArn"),
taskDefinition=data.get("taskDefinition"),
availabilityZoneRebalancing=data.get("availabilityZoneRebalancing"),
loadBalancers=data.get("loadBalancers"),
serviceRegistries=data.get("serviceRegistries"),
desiredCount=data.get("desiredCount"),
clientToken=self.serialize(clientToken),
launchType=data.get("launchType"),
capacityProviderStrategy=data.get("capacityProviderStrategy"),
platformVersion=data.get("platformVersion"),
role=data.get("roleArn"),
deploymentConfiguration=data.get("deploymentConfiguration"),
placementConstraints=data.get("placementConstraints"),
placementStrategy=data.get("placementStrategy"),
networkConfiguration=data.get("networkConfiguration"),
healthCheckGracePeriodSeconds=data.get("healthCheckGracePeriodSeconds"),
schedulingStrategy=data.get("schedulingStrategy"),
deploymentController=data.get("deploymentController"),
tags=data.get("tags"),
enableECSManagedTags=data.get("enableECSManagedTags"),
propagateTags=data.get("propagateTags"),
enableExecuteCommand=data.get("enableExecuteCommand"),
serviceConnectConfiguration=self.serialize(serviceConnectConfiguration),
volumeConfigurations=self.serialize(volumeConfigurations),
vpcLatticeConfigurations=self.serialize(vpcLatticeConfigurations),
)
_response = self.client.create_service(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateServiceResponse(**_response)
self.sessionize(response.service)
return cast("Service", response.service)
[docs] def delete(
self, service: str, *, cluster: "str | None" = None, force: bool = False
) -> "Service":
"""
Delete an ECS service.
Args:
service: The name of the service to delete.
Keyword Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service to delete. If you
do not specify a cluster, the default cluster is assumed.
force: If ``true``, allows you to delete a service even if it wasn't scaled down to zero tasks. It's only necessary
to use this if the service uses the ``REPLICA`` scheduling strategy.
"""
args: dict[str, Any] = dict(
service=self.serialize(service),
cluster=self.serialize(cluster),
force=self.serialize(force),
)
_response = self.client.delete_service(
**{k: v for k, v in args.items() if v is not None}
)
response = DeleteServiceResponse(**_response)
return cast("Service", response.service)
[docs] def get(
self,
service: str,
*,
cluster: "str | None" = None,
include: "builtins.list[Literal['TAGS']] | None" = None,
) -> "Service | None":
"""
Describes the specified services running in your cluster.
Args:
service: The name or full Amazon Resource Name (ARN) of the service to describe.
Keyword Args:
cluster: The short name or full Amazon Resource Name (ARN)the cluster that hosts the service to describe. If you do
not specify a cluster, the default cluster is assumed. This parameter is required if the service or services you are
describing were launched in any cluster other than the default cluster.
include: Determines whether you want to see the resource tags for the service. If ``TAGS`` is specified, the tags
are included in the response. If this field is omitted, tags aren't included in the response.
"""
args: dict[str, Any] = dict(
services=self.serialize([service]),
cluster=self.serialize(cluster),
include=self.serialize(include),
)
_response = self.client.describe_services(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeServicesResponse(**_response)
if response and response.services:
self.sessionize(response.services[0])
return response.services[0]
return None
[docs] def get_many(
self,
services: "builtins.list[str]",
*,
cluster: str = "default",
include: "builtins.list[Literal['TAGS']] | None" = None,
) -> "PrimaryBoto3ModelQuerySet | DescribeServicesResponse | None":
"""
Describes the specified services running in your cluster.
Args:
services: A list of services to describe. You may specify up to 10 services to describe in a single operation.
Keyword Args:
cluster: The short name or full Amazon Resource Name (ARN)the cluster that hosts the service to describe. If you do
not specify a cluster, the default cluster is assumed. This parameter is required if the service or services you are
describing were launched in any cluster other than the default cluster.
include: Determines whether you want to see the resource tags for the service. If ``TAGS`` is specified, the tags
are included in the response. If this field is omitted, tags aren't included in the response.
"""
args: dict[str, Any] = dict(
services=self.serialize(services),
cluster=self.serialize(cluster),
include=self.serialize(include),
)
_response = self.client.describe_services(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeServicesResponse(**_response)
if response.services:
self.sessionize(response.services)
return PrimaryBoto3ModelQuerySet(response.services)
return PrimaryBoto3ModelQuerySet([])
[docs] @ecs_services_only
def list(
self,
*,
cluster: "str | None" = None,
launchType: "Literal['EC2', 'FARGATE', 'EXTERNAL', 'MANAGED_INSTANCES'] | None" = None,
schedulingStrategy: "Literal['REPLICA', 'DAEMON'] | None" = None,
resourceManagementType: "Literal['CUSTOMER', 'ECS'] | None" = None,
) -> PrimaryBoto3ModelQuerySet:
"""
Returns a list of services. You can filter the results by cluster, launch type,
and scheduling strategy.
Keyword Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster to use when filtering the ``ListServices``
results. If you do not specify a cluster, the default cluster is assumed.
launchType: The launch type to use when filtering the ``ListServices`` results.
schedulingStrategy: The scheduling strategy to use when filtering the ``ListServices`` results.
resourceManagementType: The resourceManagementType type to use when filtering the ``ListServices`` results.
"""
paginator = self.client.get_paginator("list_services")
args: dict[str, Any] = dict(
cluster=self.serialize(cluster),
launchType=self.serialize(launchType),
schedulingStrategy=self.serialize(schedulingStrategy),
resourceManagementType=self.serialize(resourceManagementType),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListServicesResponse(**_response)
if response.serviceArns:
results.extend(response.serviceArns)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def update(
self,
model: "Service",
forceNewDeployment: bool = False,
serviceConnectConfiguration: "ServiceConnectConfiguration | None" = None,
volumeConfigurations: "builtins.list[ServiceVolumeConfiguration] | None" = None,
vpcLatticeConfigurations: "builtins.list[VpcLatticeConfiguration] | None" = None,
) -> "Service":
"""
Modifies the parameters of a service.
Args:
model: The :py:class:`Service` to update.
Keyword Args:
forceNewDeployment: Determines whether to force a new deployment of the service. By default, deployments aren't
forced. You can use this option to start a new deployment with no service definition changes. For example, you can
update a service's tasks to use a newer Docker image with the same image/tag combination (``my_image:latest``) or to
roll Fargate tasks onto a newer platform version.
serviceConnectConfiguration: The configuration for this service to discover and connect to services, and be
discovered by, and connected from, other services within a namespace.
volumeConfigurations: The details of the volume that was ``configuredAtLaunch``. You can configure the size,
volumeType, IOPS, throughput, snapshot and encryption in `ServiceManagedEBSVolumeConfiguration
<https://docs.aws.amazon.com/AmazonECS/latest/APIRefere nce/API_ServiceManagedEBSVolumeConfiguration.html>`_. The
``name`` of the volume must match the ``name`` from the task definition. If set to null, no new deployment is
triggered. Otherwise, if this configuration differs from the existing one, it triggers a new deployment.
vpcLatticeConfigurations: An object representing the VPC Lattice configuration for the service being updated.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
service=data.get("serviceName"),
cluster=data.get("clusterArn"),
desiredCount=data.get("desiredCount"),
taskDefinition=data.get("taskDefinition"),
capacityProviderStrategy=data.get("capacityProviderStrategy"),
deploymentConfiguration=data.get("deploymentConfiguration"),
availabilityZoneRebalancing=data.get("availabilityZoneRebalancing"),
networkConfiguration=data.get("networkConfiguration"),
placementConstraints=data.get("placementConstraints"),
placementStrategy=data.get("placementStrategy"),
platformVersion=data.get("platformVersion"),
forceNewDeployment=self.serialize(forceNewDeployment),
healthCheckGracePeriodSeconds=data.get("healthCheckGracePeriodSeconds"),
deploymentController=data.get("deploymentController"),
enableExecuteCommand=data.get("enableExecuteCommand"),
enableECSManagedTags=data.get("enableECSManagedTags"),
loadBalancers=data.get("loadBalancers"),
propagateTags=data.get("propagateTags"),
serviceRegistries=data.get("serviceRegistries"),
serviceConnectConfiguration=self.serialize(serviceConnectConfiguration),
volumeConfigurations=self.serialize(volumeConfigurations),
vpcLatticeConfigurations=self.serialize(vpcLatticeConfigurations),
)
_response = self.client.update_service(
**{k: v for k, v in args.items() if v is not None}
)
response = UpdateServiceResponse(**_response)
self.sessionize(response.service)
return cast("Service", response.service)
[docs] def partial_update(
self,
service: str,
*,
cluster: "str | None" = None,
desiredCount: "int | None" = None,
taskDefinition: "str | None" = None,
capacityProviderStrategy: "builtins.list[CapacityProviderStrategyItem] | None" = None,
deploymentConfiguration: "DeploymentConfiguration | None" = None,
availabilityZoneRebalancing: "Literal['ENABLED', 'DISABLED'] | None" = None,
networkConfiguration: "NetworkConfiguration | None" = None,
placementConstraints: "builtins.list[PlacementConstraint] | None" = None,
placementStrategy: "builtins.list[PlacementStrategy] | None" = None,
platformVersion: "str | None" = None,
forceNewDeployment: bool = False,
healthCheckGracePeriodSeconds: "int | None" = None,
deploymentController: "DeploymentController | None" = None,
enableExecuteCommand: "bool | None" = None,
enableECSManagedTags: "bool | None" = None,
loadBalancers: "builtins.list[LoadBalancerConfiguration] | None" = None,
propagateTags: "Literal['TASK_DEFINITION', 'SERVICE', 'NONE'] | None" = None,
serviceRegistries: "builtins.list[ServiceRegistry] | None" = None,
serviceConnectConfiguration: "ServiceConnectConfiguration | None" = None,
volumeConfigurations: "builtins.list[ServiceVolumeConfiguration] | None" = None,
vpcLatticeConfigurations: "builtins.list[VpcLatticeConfiguration] | None" = None,
) -> "Service":
"""
Update individual attributes of an ECS service.
Args:
service: The name of the service to update.
Keyword Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster that your service runs on. If you do not
specify a cluster, the default cluster is assumed.
desiredCount: The number of instantiations of the task to place and keep running in your service.
taskDefinition: The ``family`` and ``revision`` (``family:revision``) or full ARN of the task definition to run in
your service. If a ``revision`` is not specified, the latest ``ACTIVE`` revision is used. If you modify the task
definition with ``UpdateService``, Amazon ECS spawns a task with the new version of the task definition and then
stops an old task after the new version is running.
capacityProviderStrategy: The details of a capacity provider strategy. You can set a capacity provider when you
create a cluster, run a task, or update a service.
deploymentConfiguration: Optional deployment parameters that control how many tasks run during the deployment and
the ordering of stopping and starting tasks.
availabilityZoneRebalancing: Indicates whether to use Availability Zone rebalancing for the service.
networkConfiguration: An object representing the network configuration for the service.
placementConstraints: An array of task placement constraint objects to update the service to use. If no value is
specified, the existing placement constraints for the service will remain unchanged. If this value is specified, it
will override any existing placement constraints defined for the service. To remove all existing placement
constraints, specify an empty array.
placementStrategy: The task placement strategy objects to update the service to use. If no value is specified, the
existing placement strategy for the service will remain unchanged. If this value is specified, it will override the
existing placement strategy defined for the service. To remove an existing placement strategy, specify an empty
object.
platformVersion: The platform version that your tasks in the service run on. A platform version is only specified
for tasks using the Fargate launch type. If a platform version is not specified, the ``LATEST`` platform version is
used. For more information, see `Fargate Platform Versions
<https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html>`_ in the *Amazon Elastic
Container Service Developer Guide*.
forceNewDeployment: Determines whether to force a new deployment of the service. By default, deployments aren't
forced. You can use this option to start a new deployment with no service definition changes. For example, you can
update a service's tasks to use a newer Docker image with the same image/tag combination (``my_image:latest``) or to
roll Fargate tasks onto a newer platform version.
healthCheckGracePeriodSeconds: The period of time, in seconds, that the Amazon ECS service scheduler ignores
unhealthy Elastic Load Balancing, VPC Lattice, and container health checks after a task has first started. If you
don't specify a health check grace period value, the default value of ``0`` is used. If you don't use any of the
health checks, then ``healthCheckGracePeriodSeconds`` is unused.
deploymentController: The deployment controller to use for the service.
enableExecuteCommand: If ``true``, this enables execute command functionality on all task containers.
enableECSManagedTags: Determines whether to turn on Amazon ECS managed tags for the tasks in the service. For more
information, see `Tagging Your Amazon ECS Resources
<https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html>`_ in the *Amazon Elastic Container
Service Developer Guide*.
loadBalancers: You must have a service-linked role when you update this property
propagateTags: Determines whether to propagate the tags from the task definition or the service to the task. If no
value is specified, the tags aren't propagated.
serviceRegistries: You must have a service-linked role when you update this property.
serviceConnectConfiguration: The configuration for this service to discover and connect to services, and be
discovered by, and connected from, other services within a namespace.
volumeConfigurations: The details of the volume that was ``configuredAtLaunch``. You can configure the size,
volumeType, IOPS, throughput, snapshot and encryption in `ServiceManagedEBSVolumeConfiguration
<https://docs.aws.amazon.com/AmazonECS/latest/APIRefere nce/API_ServiceManagedEBSVolumeConfiguration.html>`_. The
``name`` of the volume must match the ``name`` from the task definition. If set to null, no new deployment is
triggered. Otherwise, if this configuration differs from the existing one, it triggers a new deployment.
vpcLatticeConfigurations: An object representing the VPC Lattice configuration for the service being updated.
"""
args: dict[str, Any] = dict(
service=self.serialize(service),
cluster=self.serialize(cluster),
desiredCount=self.serialize(desiredCount),
taskDefinition=self.serialize(taskDefinition),
capacityProviderStrategy=self.serialize(capacityProviderStrategy),
deploymentConfiguration=self.serialize(deploymentConfiguration),
availabilityZoneRebalancing=self.serialize(availabilityZoneRebalancing),
networkConfiguration=self.serialize(networkConfiguration),
placementConstraints=self.serialize(placementConstraints),
placementStrategy=self.serialize(placementStrategy),
platformVersion=self.serialize(platformVersion),
forceNewDeployment=self.serialize(forceNewDeployment),
healthCheckGracePeriodSeconds=self.serialize(healthCheckGracePeriodSeconds),
deploymentController=self.serialize(deploymentController),
enableExecuteCommand=self.serialize(enableExecuteCommand),
enableECSManagedTags=self.serialize(enableECSManagedTags),
loadBalancers=self.serialize(loadBalancers),
propagateTags=self.serialize(propagateTags),
serviceRegistries=self.serialize(serviceRegistries),
serviceConnectConfiguration=self.serialize(serviceConnectConfiguration),
volumeConfigurations=self.serialize(volumeConfigurations),
vpcLatticeConfigurations=self.serialize(vpcLatticeConfigurations),
)
_response = self.client.update_service(
**{k: v for k, v in args.items() if v is not None}
)
response = UpdateServiceResponse(**_response)
self.sessionize(response.service)
return cast("Service", response.service)
[docs]class ClusterManager(Boto3ModelManager):
service_name: str = "ecs"
[docs] def create(self, model: "Cluster") -> "Cluster":
"""
Create an ECS cluster.
Args:
model: The :py:class:`Cluster` to create.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
clusterName=data.get("clusterName"),
tags=data.get("tags"),
settings=data.get("settings"),
configuration=data.get("configuration"),
capacityProviders=data.get("capacityProviders"),
defaultCapacityProviderStrategy=data.get("defaultCapacityProviderStrategy"),
serviceConnectDefaults=data.get("serviceConnectDefaults"),
)
_response = self.client.create_cluster(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateClusterResponse(**_response)
self.sessionize(response.cluster)
return cast("Cluster", response.cluster)
[docs] def delete(self, cluster: str) -> "Cluster":
"""
Delete an ECS cluster.
Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster to delete.
"""
args: dict[str, Any] = dict(cluster=self.serialize(cluster))
_response = self.client.delete_cluster(
**{k: v for k, v in args.items() if v is not None}
)
response = DeleteClusterResponse(**_response)
return cast("Cluster", response.cluster)
[docs] def get(
self,
cluster: str,
*,
include: "builtins.list[Literal['ATTACHMENTS', 'CONFIGURATIONS', 'SETTINGS', 'STATISTICS', 'TAGS']]" = [
"ATTACHMENTS",
"CONFIGURATIONS",
"SETTINGS",
"STATISTICS",
"TAGS",
],
) -> "Cluster | None":
"""
Describes one or more of your clusters.
Args:
cluster: The name or full Amazon Resource Name (ARN) of the cluster to describe.
Keyword Args:
include: Determines whether to include additional information about the clusters in the response. If this field is
omitted, this information isn't included.
"""
args: dict[str, Any] = dict(
clusters=self.serialize([cluster]), include=self.serialize(include)
)
_response = self.client.describe_clusters(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeClustersResponse(**_response)
if response and response.clusters:
self.sessionize(response.clusters[0])
return response.clusters[0]
return None
[docs] def get_many(
self,
*,
clusters: "builtins.list[str] | None" = None,
include: "builtins.list[Literal['ATTACHMENTS', 'CONFIGURATIONS', 'SETTINGS', 'STATISTICS', 'TAGS']]" = [
"ATTACHMENTS",
"CONFIGURATIONS",
"SETTINGS",
"STATISTICS",
"TAGS",
],
) -> "PrimaryBoto3ModelQuerySet | DescribeClustersResponse | None":
"""
Describes one or more of your clusters.
Keyword Args:
clusters: A list of up to 100 cluster names or full cluster Amazon Resource Name (ARN) entries. If you do not
specify a cluster, the default cluster is assumed.
include: Determines whether to include additional information about the clusters in the response. If this field is
omitted, this information isn't included.
"""
args: dict[str, Any] = dict(
clusters=self.serialize(clusters), include=self.serialize(include)
)
_response = self.client.describe_clusters(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeClustersResponse(**_response)
if response.clusters:
self.sessionize(response.clusters)
return PrimaryBoto3ModelQuerySet(response.clusters)
return PrimaryBoto3ModelQuerySet([])
[docs] @ecs_clusters_only
def list(
self,
) -> PrimaryBoto3ModelQuerySet:
"""
Returns a list of existing clusters.
"""
paginator = self.client.get_paginator("list_clusters")
args: dict[str, Any] = dict()
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListClustersResponse(**_response)
if response.clusterArns:
results.extend(response.clusterArns)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def update(self, model: "Cluster") -> "Cluster":
"""
Update an ECS cluster.
Args:
model: The :py:class:`Cluster` to update.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
cluster=data.get("clusterName"),
settings=data.get("settings"),
configuration=data.get("configuration"),
serviceConnectDefaults=data.get("serviceConnectDefaults"),
)
_response = self.client.update_cluster(
**{k: v for k, v in args.items() if v is not None}
)
response = UpdateClusterResponse(**_response)
self.sessionize(response.cluster)
return cast("Cluster", response.cluster)
[docs] def partial_update(
self,
cluster: str,
*,
settings: "builtins.list[ClusterSetting] | None" = None,
configuration: "ClusterConfiguration | None" = None,
serviceConnectDefaults: "ClusterServiceConnectDefaultsRequest | None" = None,
) -> "Cluster":
"""
Update individual attributes of an ECS cluster.
Args:
cluster: The name of the cluster to modify the settings for.
Keyword Args:
settings: The cluster settings for your cluster.
configuration: The execute command configuration for the cluster.
serviceConnectDefaults: Use this parameter to set a default Service Connect namespace. After you set a default
Service Connect namespace, any new services with Service Connect turned on that are created in the cluster are added
as client services in the namespace. This setting only applies to new services that set the ``enabled`` parameter to
``true`` in the ``ServiceConnectConfiguration``. You can set the namespace of each service individually in the
``ServiceConnectConfiguration`` to override this default parameter.
"""
args: dict[str, Any] = dict(
cluster=self.serialize(cluster),
settings=self.serialize(settings),
configuration=self.serialize(configuration),
serviceConnectDefaults=self.serialize(serviceConnectDefaults),
)
_response = self.client.update_cluster(
**{k: v for k, v in args.items() if v is not None}
)
response = UpdateClusterResponse(**_response)
self.sessionize(response.cluster)
return cast("Cluster", response.cluster)
[docs]class TaskDefinitionManager(TaskDefinitionManagerMixin, Boto3ModelManager):
service_name: str = "ecs"
[docs] def create(
self, model: "TaskDefinition", tags: "builtins.list[ECSTag] | None" = None
) -> "TaskDefinition":
"""
Registers a new task definition from the supplied ``family`` and ``containerDefinitions``. Optionally, you can add data
volumes to your containers with the ``volumes`` parameter. For more information about task definition parameters and
defaults, see `Amazon ECS Task
Definitions <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_defintions.html>`_ in the *Amazon Elastic
Container Service Developer Guide*.
Args:
model: The :py:class:`TaskDefinition` to create.
Keyword Args:
tags: The metadata that you apply to the task definition to help you categorize and organize them. Each tag consists
of a key and an optional value. You define both of them.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
family=data.get("family"),
containerDefinitions=data.get("containerDefinitions"),
taskRoleArn=data.get("taskRoleArn"),
executionRoleArn=data.get("executionRoleArn"),
networkMode=data.get("networkMode"),
volumes=data.get("volumes"),
placementConstraints=data.get("placementConstraints"),
requiresCompatibilities=data.get("requiresCompatibilities"),
cpu=data.get("cpu"),
memory=data.get("memory"),
tags=self.serialize(tags),
pidMode=data.get("pidMode"),
ipcMode=data.get("ipcMode"),
proxyConfiguration=data.get("proxyConfiguration"),
inferenceAccelerators=data.get("inferenceAccelerators"),
ephemeralStorage=data.get("ephemeralStorage"),
runtimePlatform=data.get("runtimePlatform"),
enableFaultInjection=data.get("enableFaultInjection"),
)
_response = self.client.register_task_definition(
**{k: v for k, v in args.items() if v is not None}
)
response = RegisterTaskDefinitionResponse(**_response)
self.sessionize(response.taskDefinition)
return cast("TaskDefinition", response.taskDefinition)
[docs] @ecs_task_definition_delete_all
def delete(self, taskDefinitions: "builtins.list[str]") -> "TaskDefinition":
"""
Deletes one or more task definitions.
Args:
taskDefinitions: The ``family`` and ``revision`` (``family:revision``) or full Amazon Resource Name (ARN) of the
task definition to delete. You must specify a ``revision``.
"""
args: dict[str, Any] = dict(taskDefinitions=self.serialize(taskDefinitions))
_response = self.client.delete_task_definitions(
**{k: v for k, v in args.items() if v is not None}
)
response = DeleteTaskDefinitionsResponse(**_response)
return response
[docs] @ecs_task_definition_include_tags
def get(
self,
taskDefinition: str,
*,
include: "builtins.list[Literal['TAGS']]" = ["TAGS"],
) -> "TaskDefinition | None":
"""
Describes a task definition. You can specify a ``family`` and ``revision`` to
find information about a specific task definition, or you can simply specify the
family to find the latest ``ACTIVE`` revision in that family.
Args:
taskDefinition: The ``family`` for the latest ``ACTIVE`` revision, ``family`` and ``revision`` (``family:revision``)
for a specific revision in the family, or full Amazon Resource Name (ARN) of the task definition to describe.
Keyword Args:
include: Determines whether to see the resource tags for the task definition. If ``TAGS`` is specified, the tags are
included in the response. If this field is omitted, tags aren't included in the response.
"""
args: dict[str, Any] = dict(
taskDefinition=self.serialize(taskDefinition),
include=self.serialize(include),
)
_response = self.client.describe_task_definition(
**{k: v for k, v in args.items() if v is not None}
)
response = TaskDefinition(**_response)
if response:
self.sessionize(response)
return response
return None
[docs] @ecs_task_definitions_only
def list(
self,
*,
familyPrefix: "str | None" = None,
status: "Literal['ACTIVE', 'INACTIVE', 'DELETE_IN_PROGRESS'] | None" = None,
sort: "Literal['ASC', 'DESC'] | None" = None,
) -> PrimaryBoto3ModelQuerySet:
"""
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 the ``status`` parameter.
Keyword Args:
familyPrefix: The full family name to filter the ``ListTaskDefinitions`` results with. Specifying a ``familyPrefix``
limits the listed task definitions to task definition revisions that belong to that family.
status: The task definition status to filter the ``ListTaskDefinitions`` results with. By default, only ``ACTIVE``
task definitions are listed. By setting this parameter to ``INACTIVE``, you can view task definitions that are
``INACTIVE`` as long as an active task or service still references them. If you paginate the resulting output, be
sure to keep the ``status`` value constant in each subsequent request.
sort: The order to sort the results in. Valid values are ``ASC`` and ``DESC``. By default, (``ASC``) task
definitions are listed lexicographically by family name and in ascending numerical order by revision so that the
newest task definitions in a family are listed last. Setting this parameter to ``DESC`` reverses the sort order on
family name and revision. This is so that the newest task definitions in a family are listed first.
"""
paginator = self.client.get_paginator("list_task_definitions")
args: dict[str, Any] = dict(
familyPrefix=self.serialize(familyPrefix),
status=self.serialize(status),
sort=self.serialize(sort),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListTaskDefinitionsResponse(**_response)
if response.taskDefinitionArns:
results.extend(response.taskDefinitionArns)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def update(
self, model: "TaskDefinition", tags: "builtins.list[ECSTag] | None" = None
) -> "TaskDefinition":
"""
Registers a new task definition from the supplied ``family`` and ``containerDefinitions``. Optionally, you can add data
volumes to your containers with the ``volumes`` parameter. For more information about task definition parameters and
defaults, see `Amazon ECS Task
Definitions <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_defintions.html>`_ in the *Amazon Elastic
Container Service Developer Guide*.
Args:
model: The :py:class:`TaskDefinition` to update.
Keyword Args:
tags: The metadata that you apply to the task definition to help you categorize and organize them. Each tag consists
of a key and an optional value. You define both of them.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
family=data.get("family"),
containerDefinitions=data.get("containerDefinitions"),
taskRoleArn=data.get("taskRoleArn"),
executionRoleArn=data.get("executionRoleArn"),
networkMode=data.get("networkMode"),
volumes=data.get("volumes"),
placementConstraints=data.get("placementConstraints"),
requiresCompatibilities=data.get("requiresCompatibilities"),
cpu=data.get("cpu"),
memory=data.get("memory"),
tags=self.serialize(tags),
pidMode=data.get("pidMode"),
ipcMode=data.get("ipcMode"),
proxyConfiguration=data.get("proxyConfiguration"),
inferenceAccelerators=data.get("inferenceAccelerators"),
ephemeralStorage=data.get("ephemeralStorage"),
runtimePlatform=data.get("runtimePlatform"),
enableFaultInjection=data.get("enableFaultInjection"),
)
_response = self.client.register_task_definition(
**{k: v for k, v in args.items() if v is not None}
)
response = RegisterTaskDefinitionResponse(**_response)
self.sessionize(response.taskDefinition)
return cast("TaskDefinition", response.taskDefinition)
[docs] def deregister(self, taskDefinition: str) -> "TaskDefinition":
"""
Deregisters the specified task definition by family and revision. Upon
deregistration, the task definition is marked as ``INACTIVE``. Existing tasks
and services that reference an ``INACTIVE`` task definition continue to run
without disruption. Existing services that reference an ``INACTIVE`` task
definition can still scale up or down by modifying the service's desired count.
If you want to delete a task definition revision, you must first deregister the
task definition revision.
Args:
taskDefinition: The ``family`` and ``revision`` (``family:revision``) or full Amazon Resource Name (ARN) of the task
definition to deregister. You must specify a ``revision``.
"""
args: dict[str, Any] = dict(taskDefinition=self.serialize(taskDefinition))
_response = self.client.deregister_task_definition(
**{k: v for k, v in args.items() if v is not None}
)
response = DeregisterTaskDefinitionResponse(**_response)
results: "TaskDefinition" = None
if response is not None:
results = response.taskDefinition
self.sessionize(results)
return cast("TaskDefinition", results)
[docs] def families(
self,
*,
familyPrefix: "str | None" = None,
status: "Literal['ACTIVE', 'INACTIVE', 'ALL'] | None" = None,
) -> "builtins.list[str]":
"""
Returns a list of task definition families that are registered to your account.
This list includes task definition families that no longer have any ``ACTIVE``
task definition revisions.
Keyword Args:
familyPrefix: The ``familyPrefix`` is a string that's used to filter the results of ``ListTaskDefinitionFamilies``.
If you specify a ``familyPrefix``, only task definition family names that begin with the ``familyPrefix`` string are
returned.
status: The task definition family status to filter the ``ListTaskDefinitionFamilies`` results with. By default,
both ``ACTIVE`` and ``INACTIVE`` task definition families are listed. If this parameter is set to ``ACTIVE``, only
task definition families that have an ``ACTIVE`` task definition revision are returned. If this parameter is set to
``INACTIVE``, only task definition families that do not have any ``ACTIVE`` task definition revisions are returned.
If you paginate the resulting output, be sure to keep the ``status`` value constant in each subsequent request.
"""
paginator = self.client.get_paginator("list_task_definition_families")
args: dict[str, Any] = dict(
familyPrefix=self.serialize(familyPrefix), status=self.serialize(status)
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results: "builtins.list[str]" = []
for _response in response_iterator:
response = ListTaskDefinitionFamiliesResponse(**_response)
if response.families is not None:
results.extend(response.families)
else:
break
self.sessionize(results)
return cast("builtins.list[str]", results)
[docs]class ContainerInstanceManager(ReadonlyBoto3ModelManager):
service_name: str = "ecs"
[docs] def get(
self,
containerInstance: str,
*,
cluster: str = "default",
include: "builtins.list[Literal['TAGS', 'CONTAINER_INSTANCE_HEALTH']]" = [
"TAGS",
"CONTAINER_INSTANCE_HEALTH",
],
) -> "ContainerInstance | None":
"""
Describes one or more container instances. Returns metadata about each container
instance requested.
Args:
containerInstance: The container instance ID or full Amazon Resource Name (ARN) entry for the container instance you
want to describe.
Keyword Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instances to
describe. If you do not specify a cluster, the default cluster is assumed. This parameter is required if the
container instance or container instances you are describing were launched in any cluster other than the default
cluster.
include: Specifies whether you want to see the resource tags for the container instance. If ``TAGS`` is specified,
the tags are included in the response. If ``CONTAINER_INSTANCE_HEALTH`` is specified, the container instance health
is included in the response. If this field is omitted, tags and container instance health status aren't included in
the response.
"""
args: dict[str, Any] = dict(
containerInstances=self.serialize([containerInstance]),
cluster=self.serialize(cluster),
include=self.serialize(include),
)
_response = self.client.describe_container_instances(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeContainerInstancesResponse(**_response)
if response and response.containerInstances:
self.sessionize(response.containerInstances[0])
return response.containerInstances[0]
return None
[docs] def get_many(
self,
containerInstances: "builtins.list[str]",
*,
cluster: str = "default",
include: "builtins.list[Literal['TAGS', 'CONTAINER_INSTANCE_HEALTH']]" = [
"TAGS",
"CONTAINER_INSTANCE_HEALTH",
],
) -> "PrimaryBoto3ModelQuerySet | DescribeContainerInstancesResponse | None":
"""
Describes one or more container instances. Returns metadata about each container
instance requested.
Args:
containerInstances: A list of up to 100 container instance IDs or full Amazon Resource Name (ARN) entries.
Keyword Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instances to
describe. If you do not specify a cluster, the default cluster is assumed. This parameter is required if the
container instance or container instances you are describing were launched in any cluster other than the default
cluster.
include: Specifies whether you want to see the resource tags for the container instance. If ``TAGS`` is specified,
the tags are included in the response. If ``CONTAINER_INSTANCE_HEALTH`` is specified, the container instance health
is included in the response. If this field is omitted, tags and container instance health status aren't included in
the response.
"""
args: dict[str, Any] = dict(
containerInstances=self.serialize(containerInstances),
cluster=self.serialize(cluster),
include=self.serialize(include),
)
_response = self.client.describe_container_instances(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeContainerInstancesResponse(**_response)
if response.containerInstances:
self.sessionize(response.containerInstances)
return PrimaryBoto3ModelQuerySet(response.containerInstances)
return PrimaryBoto3ModelQuerySet([])
@ecs_container_instances_only
def list(
self,
*,
cluster: str = "default",
filter: "str | None" = None,
status: "Literal['ACTIVE', 'DRAINING', 'REGISTERING', 'DEREGISTERING', 'REGISTRATION_FAILED'] | None" = None,
) -> PrimaryBoto3ModelQuerySet:
"""
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 the ``filter`` parameter. For more information, see `Cluster
Query Language <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query-language.html>`_ in the *Amazon
Elastic Container Service Developer Guide*.
Keyword Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instances to
list. If you do not specify a cluster, the default cluster is assumed.
filter: You can filter the results of a ``ListContainerInstances`` operation with cluster query language statements.
For more information, see `Cluster Query Language
<https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query- language.html>`_ in the *Amazon Elastic
Container Service Developer Guide*.
status: Filters the container instances by status. For example, if you specify the ``DRAINING`` status, the results
include only container instances that have been set to ``DRAINING`` using `UpdateContainerInstancesState
<https://docs.aws.amazon.com /AmazonECS/latest/APIReference/API_UpdateContainerInstancesState.html>`_. If you don't
specify this parameter, the The default is to include container instances set to all states other than ``INACTIVE``.
"""
paginator = self.client.get_paginator("list_container_instances")
args: dict[str, Any] = dict(
cluster=self.serialize(cluster),
filter=self.serialize(filter),
status=self.serialize(status),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListContainerInstancesResponse(**_response)
if response.containerInstanceArns:
results.extend(response.containerInstanceArns)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def list_tasks(
self,
containerInstance: str,
*,
cluster: "str | None" = None,
family: "str | None" = None,
startedBy: "str | None" = None,
serviceName: "str | None" = None,
desiredStatus: "Literal['RUNNING', 'PENDING', 'STOPPED'] | None" = None,
launchType: "Literal['EC2', 'FARGATE', 'EXTERNAL', 'MANAGED_INSTANCES'] | None" = None,
daemonName: "str | None" = None,
) -> "builtins.list[str]":
"""
Returns a list of tasks. You can filter the results by cluster, task definition
family, container instance, launch type, what IAM principal started the task, or
by the desired status of the task.
Args:
containerInstance: The container instance ID or full ARN of the container instance to use when filtering the
``ListTasks`` results. Specifying a ``containerInstance`` limits the results to tasks that belong to that container
instance.
Keyword Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster to use when filtering the ``ListTasks``
results. If you do not specify a cluster, the default cluster is assumed.
family: The name of the task definition family to use when filtering the ``ListTasks`` results. Specifying a
``family`` limits the results to tasks that belong to that family.
startedBy: The ``startedBy`` value to filter the task results with. Specifying a ``startedBy`` value limits the
results to tasks that were started with that value.
serviceName: The name of the service to use when filtering the ``ListTasks`` results. Specifying a ``serviceName``
limits the results to tasks that belong to that service.
desiredStatus: The task desired status to use when filtering the ``ListTasks`` results. Specifying a
``desiredStatus`` of ``STOPPED`` limits the results to tasks that Amazon ECS has set the desired status to
``STOPPED``. This can be useful for debugging tasks that aren't starting properly or have died or finished. The
default status filter is ``RUNNING``, which shows tasks that Amazon ECS has set the desired status to ``RUNNING``.
launchType: The launch type to use when filtering the ``ListTasks`` results.
daemonName: The name of the daemon to use when filtering the ``ListTasks`` results. Specifying a ``daemonName``
limits the results to tasks that belong to that daemon.
"""
paginator = self.client.get_paginator("list_tasks")
args: dict[str, Any] = dict(
cluster=self.serialize(cluster),
containerInstance=self.serialize([containerInstance]),
family=self.serialize(family),
startedBy=self.serialize(startedBy),
serviceName=self.serialize(serviceName),
desiredStatus=self.serialize(desiredStatus),
launchType=self.serialize(launchType),
daemonName=self.serialize(daemonName),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results: "builtins.list[str]" = []
for _response in response_iterator:
response = ListTasksResponse(**_response)
if response.taskArns is not None:
results.extend(response.taskArns)
else:
break
self.sessionize(results)
return cast("builtins.list[str]", results)
[docs]class TaskManager(Boto3ModelManager):
service_name: str = "ecs"
[docs] @ecs_task_populate_taskDefinition
def get(
self,
task: str,
*,
cluster: str = "default",
include: "builtins.list[Literal['TAGS']]" = ["TAGS"],
) -> "Task | None":
"""
Describes a specified task or tasks.
Args:
task: The task ID or full Amazon Resource Name (ARN) entry of the task that you want to describe.
Keyword Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task or tasks to describe.
If you do not specify a cluster, the default cluster is assumed.
include: Specifies whether you want to see the resource tags for the task. If ``TAGS`` is specified, the tags are
included in the response. If this field is omitted, tags aren't included in the response.
"""
args: dict[str, Any] = dict(
tasks=self.serialize([task]),
cluster=self.serialize(cluster),
include=self.serialize(include),
)
_response = self.client.describe_tasks(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeTasksResponse(**_response)
if response and response.tasks:
self.sessionize(response.tasks[0])
return response.tasks[0]
return None
[docs] @ecs_task_populate_taskDefinitions
def get_many(
self,
tasks: "builtins.list[str]",
*,
cluster: str = "default",
include: "builtins.list[Literal['TAGS']]" = ["TAGS"],
) -> "PrimaryBoto3ModelQuerySet | DescribeTasksResponse | None":
"""
Describes a specified task or tasks.
Args:
tasks: A list of up to 100 task IDs or full ARN entries.
Keyword Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task or tasks to describe.
If you do not specify a cluster, the default cluster is assumed.
include: Specifies whether you want to see the resource tags for the task. If ``TAGS`` is specified, the tags are
included in the response. If this field is omitted, tags aren't included in the response.
"""
args: dict[str, Any] = dict(
tasks=self.serialize(tasks),
cluster=self.serialize(cluster),
include=self.serialize(include),
)
_response = self.client.describe_tasks(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeTasksResponse(**_response)
if response.tasks:
self.sessionize(response.tasks)
return PrimaryBoto3ModelQuerySet(response.tasks)
return PrimaryBoto3ModelQuerySet([])
[docs] @ecs_tasks_only
def list(
self,
*,
cluster: str = "default",
containerInstance: "str | None" = None,
family: "str | None" = None,
startedBy: "str | None" = None,
serviceName: "str | None" = None,
desiredStatus: "Literal['RUNNING', 'PENDING', 'STOPPED'] | None" = None,
launchType: "Literal['EC2', 'FARGATE', 'EXTERNAL', 'MANAGED_INSTANCES'] | None" = None,
daemonName: "str | None" = None,
) -> PrimaryBoto3ModelQuerySet:
"""
Returns a list of tasks. You can filter the results by cluster, task definition
family, container instance, launch type, what IAM principal started the task, or
by the desired status of the task.
Keyword Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster to use when filtering the ``ListTasks``
results. If you do not specify a cluster, the default cluster is assumed.
containerInstance: The container instance ID or full ARN of the container instance to use when filtering the
``ListTasks`` results. Specifying a ``containerInstance`` limits the results to tasks that belong to that container
instance.
family: The name of the task definition family to use when filtering the ``ListTasks`` results. Specifying a
``family`` limits the results to tasks that belong to that family.
startedBy: The ``startedBy`` value to filter the task results with. Specifying a ``startedBy`` value limits the
results to tasks that were started with that value.
serviceName: The name of the service to use when filtering the ``ListTasks`` results. Specifying a ``serviceName``
limits the results to tasks that belong to that service.
desiredStatus: The task desired status to use when filtering the ``ListTasks`` results. Specifying a
``desiredStatus`` of ``STOPPED`` limits the results to tasks that Amazon ECS has set the desired status to
``STOPPED``. This can be useful for debugging tasks that aren't starting properly or have died or finished. The
default status filter is ``RUNNING``, which shows tasks that Amazon ECS has set the desired status to ``RUNNING``.
launchType: The launch type to use when filtering the ``ListTasks`` results.
daemonName: The name of the daemon to use when filtering the ``ListTasks`` results. Specifying a ``daemonName``
limits the results to tasks that belong to that daemon.
"""
paginator = self.client.get_paginator("list_tasks")
args: dict[str, Any] = dict(
cluster=self.serialize(cluster),
containerInstance=self.serialize(containerInstance),
family=self.serialize(family),
startedBy=self.serialize(startedBy),
serviceName=self.serialize(serviceName),
desiredStatus=self.serialize(desiredStatus),
launchType=self.serialize(launchType),
daemonName=self.serialize(daemonName),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListTasksResponse(**_response)
if response.taskArns:
results.extend(response.taskArns)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def create(
self,
model: "Task",
capacityProviderStrategy: "builtins.list[CapacityProviderStrategyItem] | None" = None,
count: "int | None" = None,
enableECSManagedTags: "bool | None" = None,
networkConfiguration: "NetworkConfiguration | None" = None,
placementConstraints: "builtins.list[PlacementConstraint] | None" = None,
placementStrategy: "builtins.list[PlacementStrategy] | None" = None,
propagateTags: "Literal['TASK_DEFINITION', 'SERVICE', 'NONE'] | None" = None,
referenceId: "str | None" = None,
clientToken: "str | None" = None,
volumeConfigurations: "builtins.list[TaskVolumeConfiguration] | None" = None,
) -> "builtins.list[Task]":
"""
Starts a new task using the specified task definition.
Args:
model: The :py:class:`Task` to create.
Keyword Args:
capacityProviderStrategy: The capacity provider strategy to use for the task.
count: The number of instantiations of the specified task to place on your cluster. You can specify up to 10 tasks
for each call.
enableECSManagedTags: Specifies whether to use Amazon ECS managed tags for the task. For more information, see
`Tagging Your Amazon ECS Resources <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-
tags.html>`_ in the *Amazon Elastic Container Service Developer Guide*.
networkConfiguration: The network configuration for the task. This parameter is required for task definitions that
use the ``awsvpc`` network mode to receive their own elastic network interface, and it isn't supported for other
network modes. For more information, see `Task networking
<https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html>`_ in the *Amazon Elastic
Container Service Developer Guide*.
placementConstraints: An array of placement constraint objects to use for the task. You can specify up to 10
constraints for each task (including constraints in the task definition and those specified at runtime).
placementStrategy: The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules
for each task.
propagateTags: Specifies whether to propagate the tags from the task definition to the task. If no value is
specified, the tags aren't propagated. Tags can only be propagated to the task during task creation. To add tags to
a task after task creation, use the`TagResource
<https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_TagResource.html>`_ API action.
referenceId: This parameter is only used by Amazon ECS. It is not intended for use by customers.
clientToken: An identifier that you provide to ensure the idempotency of the request. It must be unique and is case
sensitive. Up to 64 characters are allowed. The valid characters are characters in the range of 33-126, inclusive.
For more information, see `Ensuring idempotency
<https://docs.aws.amazon.com/AmazonECS/latest/APIReference/ECS_Idempotency.html>`_.
volumeConfigurations: The details of the volume that was ``configuredAtLaunch``. You can configure the size,
volumeType, IOPS, throughput, snapshot and encryption in `TaskManagedEBSVolumeConfiguration
<https://docs.aws.amazon.com/AmazonECS/latest/APIReference /API_TaskManagedEBSVolumeConfiguration.html>`_. The
``name`` of the volume must match the ``name`` from the task definition.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
taskDefinition=data.get("taskDefinition"),
capacityProviderStrategy=self.serialize(capacityProviderStrategy),
cluster=data.get("clusterArn"),
count=self.serialize(count),
enableECSManagedTags=self.serialize(enableECSManagedTags),
enableExecuteCommand=data.get("enableExecuteCommand"),
group=data.get("group"),
launchType=data.get("launchType"),
networkConfiguration=self.serialize(networkConfiguration),
overrides=data.get("overrides"),
placementConstraints=self.serialize(placementConstraints),
placementStrategy=self.serialize(placementStrategy),
platformVersion=data.get("platformVersion"),
propagateTags=self.serialize(propagateTags),
referenceId=self.serialize(referenceId),
startedBy=data.get("startedBy"),
tags=data.get("tags"),
clientToken=self.serialize(clientToken),
volumeConfigurations=self.serialize(volumeConfigurations),
)
_response = self.client.run_task(
**{k: v for k, v in args.items() if v is not None}
)
response = RunTaskResponse(**_response)
self.sessionize(response.tasks[0])
return cast("builtins.list[Task]", response.tasks[0])
[docs] def delete(
self, task: str, *, cluster: "str | None" = None, reason: "str | None" = None
) -> "Task":
"""
Stops a running task. Any tags associated with the task will be deleted.
Args:
task: Thefull Amazon Resource Name (ARN) of the task.
Keyword Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task to stop. If you do not
specify a cluster, the default cluster is assumed.
reason: An optional message specified when a task is stopped. For example, if you're using a custom scheduler, you
can use this parameter to specify the reason for stopping the task here, and the message appears in subsequent
`DescribeTasks <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeTasks.html>`_> API operations
on this task.
"""
args: dict[str, Any] = dict(
task=self.serialize(task),
cluster=self.serialize(cluster),
reason=self.serialize(reason),
)
_response = self.client.stop_task(
**{k: v for k, v in args.items() if v is not None}
)
response = StopTaskResponse(**_response)
return cast("Task", response.task)
[docs]class TaskSetManager(TaskSetManagerMixin, Boto3ModelManager):
service_name: str = "ecs"
[docs] def create(self, model: "TaskSet", clientToken: "str | None" = None) -> "TaskSet":
"""
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 <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html>`_ in the *Amazon Elastic
Container Service Developer Guide*.
Args:
model: The :py:class:`TaskSet` to create.
Keyword Args:
clientToken: An identifier that you provide to ensure the idempotency of the request. It must be unique and is case
sensitive. Up to 36 ASCII characters in the range of 33-126 (inclusive) are allowed.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
service=data.get("serviceArn"),
cluster=data.get("clusterArn"),
taskDefinition=data.get("taskDefinition"),
externalId=data.get("externalId"),
networkConfiguration=data.get("networkConfiguration"),
loadBalancers=data.get("loadBalancers"),
serviceRegistries=data.get("serviceRegistries"),
launchType=data.get("launchType"),
capacityProviderStrategy=data.get("capacityProviderStrategy"),
platformVersion=data.get("platformVersion"),
scale=data.get("scale"),
clientToken=self.serialize(clientToken),
tags=data.get("tags"),
)
_response = self.client.create_task_set(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateTaskSetResponse(**_response)
self.sessionize(response.taskSet)
return cast("TaskSet", response.taskSet)
[docs] def get(
self,
cluster: str,
service: str,
taskSet: str,
*,
include: "builtins.list[Literal['TAGS']] | None" = None,
) -> "TaskSet | None":
"""
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 <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html>`_ in the *Amazon Elastic
Container Service Developer Guide*.
Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service that the task sets
exist in.
service: The short name or full Amazon Resource Name (ARN) of the service that the task sets exist in.
taskSet: The short name or full Amazon Resource Name (ARN) of the task set to describe.
Keyword Args:
include: Specifies whether to see the resource tags for the task set. If ``TAGS`` is specified, the tags are
included in the response. If this field is omitted, tags aren't included in the response.
"""
args: dict[str, Any] = dict(
cluster=self.serialize(cluster),
service=self.serialize(service),
taskSets=self.serialize([taskSet]),
include=self.serialize(include),
)
_response = self.client.describe_task_sets(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeTaskSetsResponse(**_response)
if response and response.taskSets:
self.sessionize(response.taskSets[0])
return response.taskSets[0]
return None
[docs] def get_many(
self,
cluster: str,
service: str,
*,
taskSets: "builtins.list[str] | None" = None,
include: "builtins.list[Literal['TAGS']] | None" = None,
) -> "PrimaryBoto3ModelQuerySet | DescribeTaskSetsResponse | None":
"""
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 <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html>`_ in the *Amazon Elastic
Container Service Developer Guide*.
Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service that the task sets
exist in.
service: The short name or full Amazon Resource Name (ARN) of the service that the task sets exist in.
Keyword Args:
taskSets: The ID or full Amazon Resource Name (ARN) of task sets to describe.
include: Specifies whether to see the resource tags for the task set. If ``TAGS`` is specified, the tags are
included in the response. If this field is omitted, tags aren't included in the response.
"""
args: dict[str, Any] = dict(
cluster=self.serialize(cluster),
service=self.serialize(service),
taskSets=self.serialize(taskSets),
include=self.serialize(include),
)
_response = self.client.describe_task_sets(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeTaskSetsResponse(**_response)
if response.taskSets:
self.sessionize(response.taskSets)
return PrimaryBoto3ModelQuerySet(response.taskSets)
return PrimaryBoto3ModelQuerySet([])
[docs] def update(self, model: "TaskSet") -> "TaskSet":
"""
Modifies a task set. This is used when a service uses the ``EXTERNAL`` deployment controller type. For more information,
see `Amazon ECS Deployment Types <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html>`_ in
the *Amazon Elastic Container Service Developer Guide*.
Args:
model: The :py:class:`TaskSet` to update.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
cluster=data.get("clusterArn"),
service=data.get("serviceArn"),
taskSet=data.get("taskSetArn"),
scale=data.get("scale"),
)
_response = self.client.update_task_set(
**{k: v for k, v in args.items() if v is not None}
)
response = UpdateTaskSetResponse(**_response)
self.sessionize(response.taskSet)
return cast("TaskSet", response.taskSet)
[docs] def delete(
self, cluster: str, service: str, taskSet: str, *, force: "bool | None" = None
) -> "TaskSet":
"""
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 <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html>`_ in the *Amazon Elastic
Container Service Developer Guide*.
Args:
cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service that the task set
found in to delete.
service: The short name or full Amazon Resource Name (ARN) of the service that hosts the task set to delete.
taskSet: The task set ID or full Amazon Resource Name (ARN) of the task set to delete.
Keyword Args:
force: If ``true``, you can delete a task set even if it hasn't been scaled down to zero.
"""
args: dict[str, Any] = dict(
cluster=self.serialize(cluster),
service=self.serialize(service),
taskSet=self.serialize(taskSet),
force=self.serialize(force),
)
_response = self.client.delete_task_set(
**{k: v for k, v in args.items() if v is not None}
)
response = DeleteTaskSetResponse(**_response)
return cast("TaskSet", response.taskSet)
[docs]class ServiceDeploymentManager(ReadonlyBoto3ModelManager):
service_name: str = "ecs"
[docs] def get(self, serviceDeploymentArn: str) -> "ServiceDeployment | None":
"""
Describes one or more of your service deployments.
Args:
serviceDeploymentArn: The deployment ID or full Amazon Resource Name (ARN) entry of the deployment that you want to
describe.
"""
args: dict[str, Any] = dict(
serviceDeploymentArns=self.serialize([serviceDeploymentArn])
)
_response = self.client.describe_service_deployments(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeServiceDeploymentsResponse(**_response)
if response and response.serviceDeployments:
self.sessionize(response.serviceDeployments[0])
return response.serviceDeployments[0]
return None
[docs] def get_many(
self, serviceDeploymentArns: "builtins.list[str]"
) -> "PrimaryBoto3ModelQuerySet | DescribeServiceDeploymentsResponse | None":
"""
Describes one or more of your service deployments.
Args:
serviceDeploymentArns: The ARN of the service deployment.
"""
args: dict[str, Any] = dict(
serviceDeploymentArns=self.serialize(serviceDeploymentArns)
)
_response = self.client.describe_service_deployments(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeServiceDeploymentsResponse(**_response)
if response.serviceDeployments:
self.sessionize(response.serviceDeployments)
return PrimaryBoto3ModelQuerySet(response.serviceDeployments)
return PrimaryBoto3ModelQuerySet([])
[docs] @ecs_service_deployments_only
def list(
self,
service: str,
*,
cluster: "str | None" = None,
status: "builtins.list[Literal['PENDING', 'SUCCESSFUL', 'STOPPED', 'STOP_REQUESTED', 'IN_PROGRESS', 'ROLLBACK_REQUESTED', 'ROLLBACK_IN_PROGRESS', 'ROLLBACK_SUCCESSFUL', 'ROLLBACK_FAILED']] | None" = None,
createdAt: "CreatedAt | None" = None,
nextToken: "str | None" = None,
maxResults: "int | None" = None,
) -> PrimaryBoto3ModelQuerySet:
"""
This operation lists all the service deployments that meet the specified filter
criteria.
Args:
service: The ARN or name of the service
Keyword Args:
cluster: The cluster that hosts the service. This can either be the cluster name or ARN. Starting April 15, 2023,
Amazon Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers
migrate their workloads to options that offer better price and performance. If you don't specify a cluster,
``default`` is used.
status: An optional filter you can use to narrow the results. If you do not specify a status, then all status values
are included in the result.
createdAt: An optional filter you can use to narrow the results by the service creation date. If you do not specify
a value, the result includes all services created before the current time. The format is yyyy-MM-dd HH:mm:ss.SSSSSS.
nextToken: The ``nextToken`` value returned from a ``ListServiceDeployments`` request indicating that more results
are available to fulfill the request and further calls are needed. If you provided ``maxResults``, it's possible the
number of results is fewer than ``maxResults``.
maxResults: The maximum number of service deployment results that ``ListServiceDeployments`` returned in paginated
output. When this parameter is used, ``ListServiceDeployments`` only returns ``maxResults`` results in a single page
along with a ``nextToken`` response element. The remaining results of the initial request can be seen by sending
another ``ListServiceDeployments`` request with the returned ``nextToken`` value. This value can be between 1 and
100. If this parameter isn't used, then ``ListServiceDeployments`` returns up to 20 results and a ``nextToken``
value if applicable.
"""
args: dict[str, Any] = dict(
service=self.serialize(service),
cluster=self.serialize(cluster),
status=self.serialize(status),
createdAt=self.serialize(createdAt),
nextToken=self.serialize(nextToken),
maxResults=self.serialize(maxResults),
)
_response = self.client.list_service_deployments(
**{k: v for k, v in args.items() if v is not None}
)
response = ListServiceDeploymentsResponse(**_response)
if response and response.serviceDeployments:
self.sessionize(response.serviceDeployments)
return PrimaryBoto3ModelQuerySet(response.serviceDeployments)
return PrimaryBoto3ModelQuerySet([])
[docs] def stop(
self,
serviceDeploymentArn: str,
*,
stopType: "Literal['ABORT', 'ROLLBACK'] | None" = None,
) -> str:
"""
Stops an ongoing service deployment.
Args:
serviceDeploymentArn: The ARN of the service deployment that you want to stop.
Keyword Args:
stopType: How you want Amazon ECS to stop the service.
"""
args: dict[str, Any] = dict(
serviceDeploymentArn=self.serialize(serviceDeploymentArn),
stopType=self.serialize(stopType),
)
_response = self.client.stop_service_deployment(
**{k: v for k, v in args.items() if v is not None}
)
response = StopServiceDeploymentResponse(**_response)
results: str = None
if response is not None:
results = response.serviceDeploymentArn
self.sessionize(results)
return cast("str", results)
[docs]class ServiceRevisionManager(ServiceRevisionManagerMixin, ReadonlyBoto3ModelManager):
service_name: str = "ecs"
[docs] def get(self, serviceRevisionArn: str) -> "ServiceRevision | None":
"""
Describes one or more service revisions.
Args:
serviceRevisionArn: The full Amazon Resource Name (ARN) of the service revision to describe.
"""
args: dict[str, Any] = dict(
serviceRevisionArns=self.serialize([serviceRevisionArn])
)
_response = self.client.describe_service_revisions(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeServiceRevisionsResponse(**_response)
if response and response.serviceRevisions:
self.sessionize(response.serviceRevisions[0])
return response.serviceRevisions[0]
return None
[docs] def get_many(
self, serviceRevisionArns: "builtins.list[str]"
) -> "PrimaryBoto3ModelQuerySet | DescribeServiceRevisionsResponse | None":
"""
Describes one or more service revisions.
Args:
serviceRevisionArns: The ARN of the service revision.
"""
args: dict[str, Any] = dict(
serviceRevisionArns=self.serialize(serviceRevisionArns)
)
_response = self.client.describe_service_revisions(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeServiceRevisionsResponse(**_response)
if response.serviceRevisions:
self.sessionize(response.serviceRevisions)
return PrimaryBoto3ModelQuerySet(response.serviceRevisions)
return PrimaryBoto3ModelQuerySet([])
[docs]class DaemonManager(DaemonManagerMixin, Boto3ModelManager):
service_name: str = "ecs"
[docs] def get(self, daemonArn: str) -> "Daemon | None":
"""
Describes the specified daemon.
Args:
daemonArn: The full Amazon Resource Name (ARN) of the daemon to describe.
"""
args: dict[str, Any] = dict(daemonArn=self.serialize(daemonArn))
_response = self.client.describe_daemon(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeDaemonResponse(**_response)
if response and response.daemon:
self.sessionize(response.daemon)
return response.daemon
return None
[docs]class DaemonTaskDefinitionManager(DaemonTaskDefinitionManagerMixin, Boto3ModelManager):
service_name: str = "ecs"
[docs] def get(self, daemonTaskDefinition: str) -> "DaemonTaskDefinition | None":
"""
Describes a daemon task definition. You can specify a ``family`` and
``revision`` to find information about a specific daemon task definition, or you
can simply specify the family to find the latest ``ACTIVE`` revision in that
family.
Args:
daemonTaskDefinition: The daemon task definition ARN to describe.
"""
args: dict[str, Any] = dict(
daemonTaskDefinition=self.serialize(daemonTaskDefinition)
)
_response = self.client.describe_daemon_task_definition(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeDaemonTaskDefinitionResponse(**_response)
if response and response.daemonTaskDefinition:
self.sessionize(response.daemonTaskDefinition)
return response.daemonTaskDefinition
return None
[docs]class DaemonRevisionManager(ReadonlyBoto3ModelManager):
service_name: str = "ecs"
[docs] def get(self, daemonRevisionArn: str) -> "DaemonRevision | None":
"""
Describes one or more of your daemon revisions.
Args:
daemonRevisionArn: The full Amazon Resource Name (ARN) of the daemon revision to describe.
"""
args: dict[str, Any] = dict(
daemonRevisionArns=self.serialize([daemonRevisionArn])
)
_response = self.client.describe_daemon_revisions(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeDaemonRevisionsResponse(**_response)
if response and response.daemonRevisions:
self.sessionize(response.daemonRevisions[0])
return response.daemonRevisions[0]
return None
[docs] def get_many(
self, daemonRevisionArns: "builtins.list[str]"
) -> "PrimaryBoto3ModelQuerySet | DescribeDaemonRevisionsResponse | None":
"""
Describes one or more of your daemon revisions.
Args:
daemonRevisionArns: The ARN of the daemon revisions to describe. You can specify up to 20 ARNs.
"""
args: dict[str, Any] = dict(
daemonRevisionArns=self.serialize(daemonRevisionArns)
)
_response = self.client.describe_daemon_revisions(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeDaemonRevisionsResponse(**_response)
if response.daemonRevisions:
self.sessionize(response.daemonRevisions)
return PrimaryBoto3ModelQuerySet(response.daemonRevisions)
return PrimaryBoto3ModelQuerySet([])
[docs]class DaemonDeploymentManager(DaemonDeploymentManagerMixin, ReadonlyBoto3ModelManager):
service_name: str = "ecs"
[docs]class ExpressGatewayServiceManager(
ExpressGatewayServiceManagerMixin, Boto3ModelManager
):
service_name: str = "ecs"
[docs] def create(
self,
model: "ExpressGatewayService",
executionRoleArn: str,
primaryContainer: "ExpressGatewayContainer",
healthCheckPath: "str | None" = None,
taskRoleArn: "str | None" = None,
networkConfiguration: "ExpressGatewayServiceNetworkConfiguration | None" = None,
cpu: "str | None" = None,
memory: "str | None" = None,
scalingTarget: "ExpressGatewayScalingTarget | None" = None,
) -> "ExpressGatewayService":
"""
Creates an Express service that simplifies deploying containerized web
applications on Amazon ECS with managed Amazon Web Services infrastructure. This
operation provisions and configures Application Load Balancers, target groups,
security groups, and auto-scaling policies automatically.
Args:
model: The :py:class:`ExpressGatewayService` to create.
executionRoleArn: The Amazon Resource Name (ARN) of the task execution role that grants the Amazon ECS container
agent permission to make Amazon Web Services API calls on your behalf. This role is required for Amazon ECS to pull
container images from Amazon ECR, send container logs to Amazon CloudWatch Logs, and retrieve sensitive data from
Amazon Web Services Systems Manager Parameter Store or Amazon Web Services Secrets Manager.
primaryContainer: The primary container configuration for the Express service. This defines the main application
container that will receive traffic from the Application Load Balancer.
Keyword Args:
healthCheckPath: The path on the container that the Application Load Balancer uses for health checks. This should be
a valid HTTP endpoint that returns a successful response (HTTP 200) when the application is healthy.
taskRoleArn: The Amazon Resource Name (ARN) of the IAM role that containers in this task can assume. This role
allows your application code to access other Amazon Web Services services securely.
networkConfiguration: The network configuration for the Express service tasks. This specifies the VPC subnets and
security groups for the tasks.
cpu: The number of CPU units used by the task. This parameter determines the CPU allocation for each task in the
Express service. The default value for an Express service is 256 (.25 vCPU).
memory: The amount of memory (in MiB) used by the task. This parameter determines the memory allocation for each
task in the Express service. The default value for an express service is 512 MiB.
scalingTarget: The auto-scaling configuration for the Express service. This defines how the service automatically
adjusts the number of running tasks based on demand.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
executionRoleArn=self.serialize(executionRoleArn),
infrastructureRoleArn=data.get("infrastructureRoleArn"),
primaryContainer=self.serialize(primaryContainer),
serviceName=data.get("serviceName"),
cluster=data.get("cluster"),
healthCheckPath=self.serialize(healthCheckPath),
taskRoleArn=self.serialize(taskRoleArn),
networkConfiguration=self.serialize(networkConfiguration),
cpu=self.serialize(cpu),
memory=self.serialize(memory),
scalingTarget=self.serialize(scalingTarget),
tags=data.get("tags"),
)
_response = self.client.create_express_gateway_service(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateExpressGatewayServiceResponse(**_response)
self.sessionize(response.service)
return cast("ExpressGatewayService", response.service)
[docs] def get(
self,
serviceArn: str,
*,
include: "builtins.list[Literal['TAGS']] | None" = None,
) -> "ExpressGatewayService | None":
"""
Retrieves detailed information about an Express service, including current
status, configuration, managed infrastructure, and service revisions.
Args:
serviceArn: The full Amazon Resource Name (ARN) of the Express gateway service to describe.
Keyword Args:
include: Specifies additional information to include in the response. Valid values are ``TAGS`` to include resource
tags associated with the Express service.
"""
args: dict[str, Any] = dict(
serviceArn=self.serialize(serviceArn), include=self.serialize(include)
)
_response = self.client.describe_express_gateway_service(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeExpressGatewayServiceResponse(**_response)
if response and response.service:
self.sessionize(response.service)
return response.service
return None
[docs] def delete(self, serviceArn: str) -> "ExpressGatewayService":
"""
Deletes an Express service and removes all associated Amazon Web Services
resources. This operation stops service tasks, removes the Application Load
Balancer, target groups, security groups, auto-scaling policies, and other
managed infrastructure components.
Args:
serviceArn: The Amazon Resource Name (ARN) of the Express service to delete. The ARN uniquely identifies the service
within your Amazon Web Services account and region.
"""
args: dict[str, Any] = dict(serviceArn=self.serialize(serviceArn))
_response = self.client.delete_express_gateway_service(
**{k: v for k, v in args.items() if v is not None}
)
response = DeleteExpressGatewayServiceResponse(**_response)
return cast("ExpressGatewayService", response.service)
# ==============
# Service Models
# ==============
[docs]class ECSTag(Boto3Model):
"""
The metadata that you apply to a resource to help you categorize and organize them.
Each tag consists of a key and an optional value. You define them.
The following basic restrictions apply to tags:
* Maximum number of tags per resource - 50
* For each resource, each tag key must be unique, and each tag key can have only one value.
* Maximum key length - 128 Unicode characters in UTF-8
* Maximum value length - 256 Unicode characters in UTF-8
* If your tagging schema is used across multiple services and resources, remember that other services may have
restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in
UTF-8, and the following characters: + - = . _ : / @.
* Tag keys and values are case-sensitive.
* Do not use ``aws:``, ``AWS:``, or any upper or lowercase combination of such as a prefix for either keys or values as
it is reserved for Amazon Web Services use. You cannot edit or delete tag keys or values with this prefix. Tags with
this prefix do not count against your tags per resource limit.
"""
key: "str | None" = None
"""
One part of a key-value pair that make up a tag.
A ``key`` is a general label that acts like a category for more
specific tag values.
"""
value: "str | None" = None
"""
The optional part of a key-value pair that make up a tag.
A ``value`` acts as a descriptor within a tag category (key).
"""
[docs]class ManagedScaling(Boto3Model):
"""
The managed scaling settings for the Auto Scaling group capacity provider.
When managed scaling is turned on, Amazon ECS manages the scale-in and scale-out actions of the Auto Scaling group.
Amazon ECS manages a target tracking scaling policy using an Amazon ECS managed CloudWatch metric with the specified
``targetCapacity`` value as the target value for the metric. For more information, see `Using managed
scaling <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/asg-capacity-providers.html#asg-capacity-providers-
managed-scaling>`_ in the *Amazon Elastic Container Service Developer Guide*.
If managed scaling is off, the user must manage the scaling of the Auto Scaling group.
"""
status: "Literal['ENABLED', 'DISABLED'] | None" = None
"""
Determines whether to use managed scaling for the capacity provider.
"""
targetCapacity: "int | None" = None
"""
The target capacity utilization as a percentage for the capacity provider.
The specified value must be greater than
``0`` and less than or equal to ``100``. For example, if you want the capacity provider to maintain 10% spare capacity,
then that means the utilization is 90%, so use a ``targetCapacity`` of ``90``. The default value of ``100`` percent
results in the Amazon EC2 instances in your Auto Scaling group being completely used.
"""
minimumScalingStepSize: "int | None" = None
"""
The minimum number of Amazon EC2 instances that Amazon ECS will scale out at one
time.
The scale in process is not
affected by this parameter If this parameter is omitted, the default value of ``1`` is used.
"""
maximumScalingStepSize: "int | None" = None
"""
The maximum number of Amazon EC2 instances that Amazon ECS will scale out at one
time.
If this parameter is omitted, the
default value of ``10000`` is used.
"""
instanceWarmupPeriod: "int | None" = None
"""
The period of time, in seconds, after a newly launched Amazon EC2 instance can
contribute to CloudWatch metrics for Auto Scaling group.
If this parameter is omitted, the default value of ``300`` seconds is used.
"""
[docs]class AutoScalingGroupProvider(Boto3Model):
"""
The details of the Auto Scaling group for the capacity provider.
"""
autoScalingGroupArn: str
"""
The Amazon Resource Name (ARN) that identifies the Auto Scaling group, or the Auto
Scaling group name.
"""
managedScaling: "ManagedScaling | None" = None
"""
The managed scaling settings for the Auto Scaling group capacity provider.
"""
managedTerminationProtection: "Literal['ENABLED', 'DISABLED'] | None" = None
"""
The managed termination protection setting to use for the Auto Scaling group
capacity provider.
This determines whether the Auto Scaling group has managed termination protection.
The default is off.
"""
managedDraining: "Literal['ENABLED', 'DISABLED'] | None" = None
"""
The managed draining option for the Auto Scaling group capacity provider.
When you enable this, Amazon ECS manages and gracefully drains the EC2 container
instances that are in the Auto Scaling group capacity provider.
"""
[docs]class ManagedInstancesNetworkConfiguration(Boto3Model):
"""
The network configuration for Amazon ECS Managed Instances.
This specifies the VPC subnets and security groups that
instances use for network connectivity. Amazon ECS Managed Instances support multiple network modes including ``awsvpc``
(instances receive ENIs for task isolation), ``host`` (instances share network namespace with tasks), and ``none`` (no
external network connectivity), ensuring backward compatibility for migrating workloads from Fargate or Amazon EC2.
"""
subnets: "builtins.list[str] | None" = Field(default_factory=list)
"""
The list of subnet IDs where Amazon ECS can launch Amazon ECS Managed Instances.
Instances are distributed across the specified subnets for high availability. All
subnets must be in the same VPC.
"""
securityGroups: "builtins.list[str] | None" = Field(default_factory=list)
"""
The list of security group IDs to apply to Amazon ECS Managed Instances.
These security groups control the network traffic allowed to and from the instances.
"""
[docs]class ManagedInstancesStorageConfiguration(Boto3Model):
"""
The storage configuration for Amazon ECS Managed Instances.
This defines the data volume configuration for the instances.
"""
storageSizeGiB: "int | None" = None
"""
The size of the data volume.
"""
[docs]class ManagedInstancesLocalStorageConfiguration(Boto3Model):
"""
The local storage configuration for Amazon ECS Managed Instances.
This defines how ECS uses and configures instance store volumes available on
container instance.
"""
useLocalStorage: "bool | None" = None
"""
Use instance store volumes for data storage when available.
EBS volumes are not provisioned for data storage. If the
container instance has multiple instance store volumes, a single data volume is created. Consider defining instance
store requirements using the ``localStorage``, ``localStorageTypes`` and ``totalLocalStorageGB`` properties.
"""
[docs]class ECSVCpuCountRangeRequest(Boto3Model):
"""
The minimum and maximum number of vCPUs for instance type selection.
This allows you to specify a range of vCPU counts that meet your workload
requirements.
"""
min: int
"""
The minimum number of vCPUs.
Instance types with fewer vCPUs than this value are excluded from selection.
"""
max: "int | None" = None
"""
The maximum number of vCPUs.
Instance types with more vCPUs than this value are excluded from selection.
"""
[docs]class ECSMemoryMiBRequest(Boto3Model):
"""
The minimum and maximum amount of memory in mebibytes (MiB) for instance type
selection.
This ensures that selected instance types have adequate memory for your workloads.
"""
min: int
"""
The minimum amount of memory in MiB.
Instance types with less memory than this value are excluded from selection.
"""
max: "int | None" = None
"""
The maximum amount of memory in MiB.
Instance types with more memory than this value are excluded from selection.
"""
[docs]class ECSMemoryGiBPerVCpuRequest(Boto3Model):
"""
The minimum and maximum amount of memory per vCPU in gibibytes (GiB).
This helps ensure that instance types have the appropriate memory-to-CPU ratio for
your workloads.
"""
min: "float | None" = None
"""
The minimum amount of memory per vCPU in GiB.
Instance types with a lower memory-to-vCPU ratio are excluded from selection.
"""
max: "float | None" = None
"""
The maximum amount of memory per vCPU in GiB.
Instance types with a higher memory-to-vCPU ratio are excluded from selection.
"""
[docs]class ECSNetworkInterfaceCountRequest(Boto3Model):
"""
The minimum and maximum number of network interfaces for instance type selection.
This is useful for workloads that require multiple network interfaces.
"""
min: "int | None" = None
"""
The minimum number of network interfaces.
Instance types that support fewer network interfaces are excluded from selection.
"""
max: "int | None" = None
"""
The maximum number of network interfaces.
Instance types that support more network interfaces are excluded from selection.
"""
[docs]class ECSTotalLocalStorageGBRequest(Boto3Model):
"""
The minimum and maximum total local storage in gigabytes (GB) for instance types
with local storage.
This is useful for workloads that require local storage for temporary data or
caching.
"""
min: "float | None" = None
"""
The minimum total local storage in GB.
Instance types with less local storage are excluded from selection.
"""
max: "float | None" = None
"""
The maximum total local storage in GB.
Instance types with more local storage are excluded from selection.
"""
[docs]class ECSBaselineEbsBandwidthMbpsRequest(Boto3Model):
"""
The minimum and maximum baseline Amazon EBS bandwidth in megabits per second (Mbps)
for instance type selection.
This is important for workloads with high storage I/O requirements.
"""
min: "int | None" = None
"""
The minimum baseline Amazon EBS bandwidth in Mbps.
Instance types with lower Amazon EBS bandwidth are excluded from selection.
"""
max: "int | None" = None
"""
The maximum baseline Amazon EBS bandwidth in Mbps.
Instance types with higher Amazon EBS bandwidth are excluded from selection.
"""
[docs]class ECSAcceleratorCountRequest(Boto3Model):
"""
The minimum and maximum number of accelerators (such as GPUs) for instance type
selection.
This is used for workloads that require specific numbers of accelerators.
"""
min: "int | None" = None
"""
The minimum number of accelerators.
Instance types with fewer accelerators are excluded from selection.
"""
max: "int | None" = None
"""
The maximum number of accelerators.
Instance types with more accelerators are excluded from selection.
"""
[docs]class ECSAcceleratorTotalMemoryMiBRequest(Boto3Model):
"""
The minimum and maximum total accelerator memory in mebibytes (MiB) for instance
type selection.
This is important for GPU workloads that require specific amounts of video memory.
"""
min: "int | None" = None
"""
The minimum total accelerator memory in MiB.
Instance types with less accelerator memory are excluded from selection.
"""
max: "int | None" = None
"""
The maximum total accelerator memory in MiB.
Instance types with more accelerator memory are excluded from selection.
"""
[docs]class ECSNetworkBandwidthGbpsRequest(Boto3Model):
"""
The minimum and maximum network bandwidth in gigabits per second (Gbps) for instance
type selection.
This is important for network-intensive workloads.
"""
min: "float | None" = None
"""
The minimum network bandwidth in Gbps.
Instance types with lower network bandwidth are excluded from selection.
"""
max: "float | None" = None
"""
The maximum network bandwidth in Gbps.
Instance types with higher network bandwidth are excluded from selection.
"""
[docs]class ECSInstanceRequirementsRequest(Boto3Model):
"""
The instance requirements for attribute-based instance type selection.
Instead of specifying exact instance types, you define requirements such as vCPU
count, memory size, network performance, and accelerator specifications. Amazon ECS
automatically selects Amazon EC2 instance types that match these requirements,
providing flexibility and helping to mitigate capacity constraints.
"""
vCpuCount: ECSVCpuCountRangeRequest
"""
The minimum and maximum number of vCPUs for the instance types.
Amazon ECS selects instance types that have vCPU counts within this range.
"""
memoryMiB: ECSMemoryMiBRequest
"""
The minimum and maximum amount of memory in mebibytes (MiB) for the instance types.
Amazon ECS selects instance types that have memory within this range.
"""
cpuManufacturers: "builtins.list[Literal['intel', 'amd', 'amazon-web-services']] | None" = Field(
default_factory=list
)
"""
The CPU manufacturers to include or exclude.
You can specify ``intel``, ``amd``, or ``amazon-web-services`` to control
which CPU types are used for your workloads.
"""
memoryGiBPerVCpu: "ECSMemoryGiBPerVCpuRequest | None" = None
"""
The minimum and maximum amount of memory per vCPU in gibibytes (GiB).
This helps ensure that instance types have the appropriate memory-to-CPU ratio for
your workloads.
"""
excludedInstanceTypes: "builtins.list[str] | None" = Field(default_factory=list)
"""
The instance types to exclude from selection.
Use this to prevent Amazon ECS from selecting specific instance types that may not
be suitable for your workloads.
"""
instanceGenerations: "builtins.list[Literal['current', 'previous']] | None" = Field(
default_factory=list
)
"""
The instance generations to include.
You can specify ``current`` to use the latest generation instances, or ``previous``
to include previous generation instances for cost optimization.
"""
spotMaxPricePercentageOverLowestPrice: "int | None" = None
"""
The maximum price for Spot instances as a percentage over the lowest priced On-
Demand instance.
This helps control Spot instance costs while maintaining access to capacity.
"""
onDemandMaxPricePercentageOverLowestPrice: "int | None" = None
"""
The price protection threshold for On-Demand Instances, as a percentage higher than
an identified On-Demand price.
The identified On-Demand price is the price of the lowest priced current generation
C, M, or R instance type with your specified attributes. If no current generation C,
M, or R instance type matches your attributes, then the identified price is from
either the lowest priced current generation instance types or, failing that, the
lowest priced previous generation instance types that match your attributes. When
Amazon ECS selects instance types with your attributes, we will exclude instance
types whose price exceeds your specified threshold.
"""
bareMetal: "Literal['included', 'required', 'excluded'] | None" = None
"""
Indicates whether to include bare metal instance types.
Set to ``included`` to allow bare metal instances, ``excluded``
to exclude them, or ``required`` to use only bare metal instances.
"""
burstablePerformance: "Literal['included', 'required', 'excluded'] | None" = None
"""
Indicates whether to include burstable performance instance types (T2, T3, T3a,
T4g).
Set to ``included`` to allow
burstable instances, ``excluded`` to exclude them, or ``required`` to use only burstable instances.
"""
requireHibernateSupport: "bool | None" = None
"""
Indicates whether the instance types must support hibernation.
When set to ``true``, only instance types that support
hibernation are selected.
"""
networkInterfaceCount: "ECSNetworkInterfaceCountRequest | None" = None
"""
The minimum and maximum number of network interfaces for the instance types.
This is useful for workloads that require multiple network interfaces.
"""
localStorage: "Literal['included', 'required', 'excluded'] | None" = None
"""
Indicates whether to include instance types with local storage.
Set to ``included`` to allow local storage, ``excluded``
to exclude it, or ``required`` to use only instances with local storage.
"""
localStorageTypes: "builtins.list[Literal['hdd', 'ssd']] | None" = Field(
default_factory=list
)
"""
The local storage types to include.
You can specify ``hdd`` for hard disk drives, ``ssd`` for solid state drives, or
both.
"""
totalLocalStorageGB: "ECSTotalLocalStorageGBRequest | None" = None
"""
The minimum and maximum total local storage in gigabytes (GB) for instance types
with local storage.
"""
baselineEbsBandwidthMbps: "ECSBaselineEbsBandwidthMbpsRequest | None" = None
"""
The minimum and maximum baseline Amazon EBS bandwidth in megabits per second (Mbps).
This is important for workloads with high storage I/O requirements.
"""
acceleratorTypes: "builtins.list[Literal['gpu', 'fpga', 'inference']] | None" = (
Field(default_factory=list)
)
"""
The accelerator types to include.
You can specify ``gpu`` for graphics processing units, ``fpga`` for field programmable
gate arrays, or ``inference`` for machine learning inference accelerators.
"""
acceleratorCount: "ECSAcceleratorCountRequest | None" = None
"""
The minimum and maximum number of accelerators for the instance types.
This is used when you need instances with specific numbers of GPUs or other
accelerators.
"""
acceleratorManufacturers: "builtins.list[Literal['amazon-web-services', 'amd', 'nvidia', 'xilinx', 'habana']] | None" = Field(
default_factory=list
)
"""
The accelerator manufacturers to include.
You can specify ``nvidia``, ``amd``, ``amazon-web-services``, or ``xilinx``
depending on your accelerator requirements.
"""
acceleratorNames: "builtins.list[Literal['a100', 'inferentia', 'k520', 'k80', 'm60', 'radeon-pro-v520', 't4', 'vu9p', 'v100', 'a10g', 'h100', 't4g']] | None" = Field(
default_factory=list
)
"""
The specific accelerator names to include.
For example, you can specify ``a100``, ``v100``, ``k80``, or other specific
accelerator models.
"""
acceleratorTotalMemoryMiB: "ECSAcceleratorTotalMemoryMiBRequest | None" = None
"""
The minimum and maximum total accelerator memory in mebibytes (MiB).
This is important for GPU workloads that require specific amounts of video memory.
"""
networkBandwidthGbps: "ECSNetworkBandwidthGbpsRequest | None" = None
"""
The minimum and maximum network bandwidth in gigabits per second (Gbps).
This is crucial for network-intensive workloads that require high throughput.
"""
allowedInstanceTypes: "builtins.list[str] | None" = Field(default_factory=list)
"""
The instance types to include in the selection.
When specified, Amazon ECS only considers these instance types, subject to the other
requirements specified.
"""
maxSpotPriceAsPercentageOfOptimalOnDemandPrice: "int | None" = None
"""
The maximum price for Spot instances as a percentage of the optimal On-Demand price.
This provides more precise cost control for Spot instance selection.
"""
[docs]class CapacityReservationRequest(Boto3Model):
"""
The Capacity Reservation configurations to be used when using the ``RESERVED``
capacity option type.
"""
reservationGroupArn: "str | None" = None
"""
The ARN of the Capacity Reservation resource group in which to run the instance.
"""
reservationPreference: "Literal['RESERVATIONS_ONLY', 'RESERVATIONS_FIRST', 'RESERVATIONS_EXCLUDED'] | None" = None
"""
The preference on when capacity reservations should be used.
"""
[docs]class InstanceLaunchTemplate(Boto3Model):
"""
The launch template configuration for Amazon ECS Managed Instances.
This defines how Amazon ECS launches Amazon EC2 instances, including the instance
profile for your tasks, network and storage configuration, capacity options, and
instance requirements for flexible instance type selection.
"""
ec2InstanceProfileArn: str
"""
The Amazon Resource Name (ARN) of the instance profile that Amazon ECS applies to
Amazon ECS Managed Instances.
This instance profile must include the necessary permissions for your tasks to
access Amazon Web Services services and resources.
"""
networkConfiguration: ManagedInstancesNetworkConfiguration
"""
The network configuration for Amazon ECS Managed Instances.
This specifies the subnets and security groups that instances use for network
connectivity.
"""
storageConfiguration: "ManagedInstancesStorageConfiguration | None" = None
"""
The storage configuration for Amazon ECS Managed Instances.
This defines the data volume properties for the instances.
"""
localStorageConfiguration: "ManagedInstancesLocalStorageConfiguration | None" = None
"""
The local storage configuration for Amazon ECS Managed Instances.
This defines how ECS uses instance store volumes available on the container
instance.
"""
monitoring: "Literal['BASIC', 'DETAILED'] | None" = None
"""
CloudWatch provides two categories of monitoring: basic monitoring and detailed monitoring. By default, your managed
instance is configured for basic monitoring. You can optionally enable detailed monitoring to help you more quickly
identify and act on operational issues. You can enable or turn off detailed monitoring at launch or when the managed
instance is running or stopped. For more information, see `Detailed monitoring for Amazon ECS Managed
Instances <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/detailed-monitoring-managed-instances.html>`_ in
the Amazon ECS Developer Guide.
"""
capacityOptionType: "Literal['ON_DEMAND', 'SPOT', 'RESERVED'] | None" = None
"""
The capacity option type.
This determines whether Amazon ECS launches On-Demand, Spot or Capacity Reservation
Instances for your managed instance capacity provider.
"""
instanceMetadataTagsPropagation: "bool | None" = None
"""
Determines whether tags are propagated to the instance metadata service (IMDS) for
Amazon EC2 instances launched by the Managed Instances capacity provider.
When enabled, all tags associated with the instance are available through the
instance metadata service. When disabled, tags are not propagated to IMDS.
"""
instanceRequirements: "ECSInstanceRequirementsRequest | None" = None
"""
The instance requirements.
You can specify:
"""
fipsEnabled: "bool | None" = None
"""
Determines whether to enable FIPS 140-2 validated cryptographic modules on EC2
instances launched by the capacity provider.
If ``true``, instances use FIPS-compliant cryptographic algorithms and modules for enhanced security
compliance. If ``false``, instances use standard cryptographic implementations.
"""
capacityReservations: "CapacityReservationRequest | None" = None
"""
Capacity reservation specifications.
You can specify:
"""
[docs]class InfrastructureOptimization(Boto3Model):
"""
The configuration that controls how Amazon ECS optimizes your infrastructure.
"""
scaleInAfter: "int | None" = None
"""
This parameter defines the number of seconds Amazon ECS Managed Instances waits
before optimizing EC2 instances that have become idle or underutilized.
A longer delay increases the likelihood of placing new tasks on idle or
underutilized instances instances, reducing startup time. A shorter delay helps
reduce infrastructure costs by optimizing idle or underutilized instances,instances
more quickly.
"""
[docs]class AutoRepairConfiguration(Boto3Model):
"""
The auto repair configuration for an Amazon ECS Managed Instances capacity provider.
When enabled, Amazon ECS automatically replaces container instances that are
detected as unhealthy based on container instance health checks, including
accelerated compute device and daemon health checks.
"""
actionsStatus: "Literal['ENABLED', 'DISABLED'] | None" = None
"""
The status of auto repair actions for the capacity provider.
When set to ``ENABLED``, Amazon ECS automatically replaces
container instances with an ``IMPAIRED`` health status. When set to ``DISABLED``, Amazon ECS still monitors container
instance health but does not automatically replace impaired instances.
"""
[docs]class ManagedInstancesProvider(Boto3Model):
"""
The configuration for a Amazon ECS Managed Instances provider.
Amazon ECS uses this configuration to automatically launch, manage, and terminate
Amazon EC2 instances on your behalf. Managed instances provide access to the full
range of Amazon EC2 instance types and features while offloading infrastructure
management to Amazon Web Services.
"""
infrastructureRoleArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the infrastructure role that Amazon ECS assumes to
manage instances.
This role must include permissions for Amazon EC2 instance lifecycle management,
networking, and any additional Amazon Web Services services required for your
workloads.
"""
instanceLaunchTemplate: "InstanceLaunchTemplate | None" = None
"""
The launch template that defines how Amazon ECS launches Amazon ECS Managed
Instances.
This includes the instance profile for your tasks, network and storage
configuration, and instance requirements that determine which Amazon EC2 instance
types can be used.
"""
propagateTags: "Literal['CAPACITY_PROVIDER', 'NONE'] | None" = None
"""
Determines whether tags from the capacity provider are automatically applied to
Amazon ECS Managed Instances.
This helps with cost allocation and resource management by ensuring consistent
tagging across your infrastructure.
"""
infrastructureOptimization: "InfrastructureOptimization | None" = None
"""
Defines how Amazon ECS Managed Instances optimizes the infrastastructure in your
capacity provider.
Configure it to turn on or off the infrastructure optimization in your capacity
provider, and to control the idle or underutilized EC2 instances optimization delay.
"""
autoRepairConfiguration: "AutoRepairConfiguration | None" = None
"""
The auto repair configuration for the Amazon ECS Managed Instances capacity
provider.
Indicates whether Amazon ECS automatically replaces container instances that are
detected as unhealthy.
"""
[docs]class CapacityProvider(TagsDictMixin, PrimaryBoto3Model):
"""
The details for a capacity provider.
"""
tag_class: ClassVar[type[Boto3Model]] = ECSTag
manager_class: ClassVar[type[Boto3ModelManager]] = CapacityProviderManager
Name: str = Field(default=None, alias="name")
"""
The name of the capacity provider.
"""
Tags: "builtins.list[ECSTag]" = Field(default_factory=list, alias="tags")
"""
The metadata that you apply to the capacity provider to help you categorize and
organize it.
Each tag consists of a key and an optional value. You define both.
"""
capacityProviderArn: str = Field(default=None, frozen=True)
"""
The Amazon Resource Name (ARN) that identifies the capacity provider.
"""
cluster: "str | None" = None
"""
The cluster that this capacity provider is associated with.
Managed instances capacity providers are cluster-scoped, meaning they can only be
used within their associated cluster.
"""
status: Literal["PROVISIONING", "ACTIVE", "DEPROVISIONING", "INACTIVE"] = Field(
default=None, frozen=True
)
"""
The current status of the capacity provider.
Only capacity providers in an ``ACTIVE`` state can be used in a cluster.
When a capacity provider is successfully deleted, it has an ``INACTIVE`` status.
"""
autoScalingGroupProvider: "AutoScalingGroupProvider | None" = None
"""
The Auto Scaling group settings for the capacity provider.
"""
managedInstancesProvider: "ManagedInstancesProvider | None" = None
"""
The configuration for the Amazon ECS Managed Instances provider.
This includes the infrastructure role, the launch template configuration, and tag
propagation settings.
"""
updateStatus: Literal[
"CREATE_IN_PROGRESS",
"CREATE_COMPLETE",
"CREATE_FAILED",
"DELETE_IN_PROGRESS",
"DELETE_COMPLETE",
"DELETE_FAILED",
"UPDATE_IN_PROGRESS",
"UPDATE_COMPLETE",
"UPDATE_FAILED",
] = Field(default=None, frozen=True)
"""
The update status of the capacity provider.
The following are the possible states that is returned.
"""
updateStatusReason: str = Field(default=None, frozen=True)
"""
The update status reason.
This provides further details about the update status for the capacity provider.
"""
type: Literal["EC2_AUTOSCALING", "MANAGED_INSTANCES", "FARGATE", "FARGATE_SPOT"] = (
Field(default=None, frozen=True)
)
"""
The type of capacity provider.
For Amazon ECS Managed Instances, this value is ``MANAGED_INSTANCES``, indicating that
Amazon ECS manages the underlying Amazon EC2 instances on your behalf.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`capacityProviderArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.capacityProviderArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the
:py:attr:`capacityProviderArn` attribute.
Returns:
The ARN of the model instance.
"""
return self.capacityProviderArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`Name`
attribute.
Returns:
The name of the model instance.
"""
return self.Name
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`capacityProviderArn` attribute.
"""
return hash(self.capacityProviderArn)
[docs]class AdvancedConfiguration(Boto3Model):
"""
The advanced settings for a load balancer used in blue/green deployments.
Specify the alternate target group, listener
rules, and IAM role required for traffic shifting during blue/green deployments. For more information, see `Required
resources for Amazon ECS blue/green deployments <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/blue-green-
deployment-implementation.html>`_ in the *Amazon Elastic Container Service Developer Guide*.
"""
alternateTargetGroupArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the alternate target group for Amazon ECS
blue/green deployments.
"""
productionListenerRule: "str | None" = None
"""
The Amazon Resource Name (ARN) that that identifies the production listener rule (in
the case of an Application Load Balancer) or listener (in the case for an Network
Load Balancer) for routing production traffic.
"""
testListenerRule: "str | None" = None
"""
The Amazon Resource Name (ARN) that identifies ) that identifies the test listener
rule (in the case of an Application Load Balancer) or listener (in the case for an
Network Load Balancer) for routing test traffic.
"""
roleArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the IAM role that grants Amazon ECS permission to
call the Elastic Load Balancing APIs for you.
"""
[docs]class LoadBalancerConfiguration(Boto3Model):
"""
The load balancer configuration to use with a service or task set.
When you add, update, or remove a load balancer configuration, Amazon ECS starts a new deployment with the updated
Elastic Load Balancing configuration. This causes tasks to register to and deregister from load balancers.
We recommend that you verify this on a test environment before you update the Elastic Load Balancing configuration.
A service-linked role is required for services that use multiple target groups. For more information, see `Using
service-linked roles <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using-service-linked-roles.html>`_ in
the *Amazon Elastic Container Service Developer Guide*.
"""
targetGroupArn: "str | None" = None
"""
The full Amazon Resource Name (ARN) of the Elastic Load Balancing target group or
groups associated with a service or task set.
"""
loadBalancerName: "str | None" = None
"""
The name of the load balancer to associate with the Amazon ECS service or task set.
"""
containerName: "str | None" = None
"""
The name of the container (as it appears in a container definition) to associate
with the load balancer.
"""
containerPort: "int | None" = None
"""
The port on the container to associate with the load balancer.
This port must correspond to a ``containerPort`` in the
task definition the tasks in the service are using. For tasks that use the EC2 launch type, the container instance
they're launched on must allow ingress traffic on the ``hostPort`` of the port mapping.
"""
advancedConfiguration: "AdvancedConfiguration | None" = None
"""
The advanced settings for the load balancer used in blue/green deployments.
Specify the alternate target group, listener rules, and IAM role required for
traffic shifting during blue/green deployments.
"""
[docs]class ServiceRegistry(Boto3Model):
"""
The details for the service registry.
Each service may be associated with one service registry. Multiple service
registries for each service are not supported.
When you add, update, or remove the service registries configuration, Amazon ECS
starts a new deployment. New tasks are registered and deregistered to the updated
service registry configuration.
"""
registryArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the service registry.
The currently supported service registry is Cloud Map. For more information, see
`CreateService <https://docs.aws.amazon.com/cloud-map/latest/api/API_CreateService.html>`_.
"""
port: "int | None" = None
"""
The port value used if your service discovery service specified an SRV record.
This field might be used if both the
``awsvpc`` network mode and SRV records are used.
"""
containerName: "str | None" = None
"""
The container name value to be used for your service discovery service.
It's already specified in the task definition.
If the task definition that your service task specifies uses the ``bridge`` or ``host`` network mode, you must specify a
``containerName`` and ``containerPort`` combination from the task definition. If the task definition that your service
task specifies uses the ``awsvpc`` network mode and a type SRV DNS record is used, you must specify either a
``containerName`` and ``containerPort`` combination or a ``port`` value. However, you can't specify both.
"""
containerPort: "int | None" = None
"""
The port value to be used for your service discovery service.
It's already specified in the task definition. If the task
definition your service task specifies uses the ``bridge`` or ``host`` network mode, you must specify a
``containerName`` and ``containerPort`` combination from the task definition. If the task definition your service task
specifies uses the ``awsvpc`` network mode and a type SRV DNS record is used, you must specify either a
``containerName`` and ``containerPort`` combination or a ``port`` value. However, you can't specify both.
"""
[docs]class CapacityProviderStrategyItem(Boto3Model):
"""The details of a capacity provider strategy. A capacity provider strategy can be set when using the
`RunTask <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html>`_or
`CreateCluster <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_CreateCluster.html>`_ APIs or as the default
capacity provider strategy for a cluster with the ``CreateCluster`` API.
Only capacity providers that are already associated with a cluster and have an ``ACTIVE`` or ``UPDATING`` status can be
used in a capacity provider strategy. The `PutClusterCapacityProviders <https://docs.aws.amazon.com/AmazonECS/latest/API
Reference/API_PutClusterCapacityProviders.html>`_ API is used to associate a capacity provider with a cluster.
If specifying a capacity provider that uses an Auto Scaling group, the capacity provider must already be created. New
Auto Scaling group capacity providers can be created with the `CreateClusterCapacityProvider <https://docs.aws.amazon.co
m/AmazonECS/latest/APIReference/API_CreateClusterCapacityProvider.html>`_ API operation.
To use a Fargate capacity provider, specify either the ``FARGATE`` or ``FARGATE_SPOT`` capacity providers. The Fargate
capacity providers are available to all accounts and only need to be associated with a cluster to be used in a capacity
provider strategy.
With ``FARGATE_SPOT``, you can run interruption tolerant tasks at a rate that's discounted compared to the ``FARGATE``
price. ``FARGATE_SPOT`` runs tasks on spare compute capacity. When Amazon Web Services needs the capacity back, your
tasks are interrupted with a two-minute warning. ``FARGATE_SPOT`` supports Linux tasks with the X86_64 architecture on
platform version 1.3.0 or later. ``FARGATE_SPOT`` supports Linux tasks with the ARM64 architecture on platform version
1.4.0 or later.
A capacity provider strategy can contain a maximum of 20 capacity providers.
"""
capacityProvider: str
"""
The short name of the capacity provider.
"""
weight: "int | None" = None
"""
The *weight* value designates the relative percentage of the total number of tasks
launched that should use the specified capacity provider.
The ``weight`` value is taken into consideration after the ``base`` value, if defined, is
satisfied.
"""
base: "int | None" = None
"""
The *base* value designates how many tasks, at a minimum, to run on the specified
capacity provider for each service.
Only one capacity provider in a capacity provider strategy can have a *base* defined. If no value is specified, the
default value of ``0`` is used.
"""
[docs]class DeploymentCircuitBreaker(Boto3Model):
"""
The deployment circuit breaker can only be used for services using the rolling
update (``ECS``) deployment type.
The **deployment circuit breaker** determines whether a service deployment will fail
if the service can't reach a steady state. If it is turned on, a service deployment
will transition to a failed state and stop launching new tasks. You can also
configure Amazon ECS to roll back your service to the last completed deployment
after a failure. For more information, see
`Rolling update <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-ecs.html>`_
in the *Amazon Elastic Container Service Developer Guide*.
For more information about API failure reasons, see
`API failure reasons <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/api_failures_messages.html>`_
in the *Amazon Elastic
Container Service Developer Guide*.
"""
enable: bool
"""
Determines whether to use the deployment circuit breaker logic for the service.
"""
rollback: bool
"""
Determines whether to configure Amazon ECS to roll back the service if a service
deployment fails.
If rollback is on, when a service deployment fails, the service is rolled back to
the last deployment that completed successfully.
"""
[docs]class DeploymentAlarms(Boto3Model):
"""
One of the methods which provide a way for you to quickly identify when a deployment
has failed, and then to optionally roll back the failure to the last working
deployment.
When the alarms are generated, Amazon ECS sets the service deployment to failed. Set the rollback parameter to have
Amazon ECS to roll back your service to the last completed deployment after a failure.
You can only use the ``DeploymentAlarms`` method to detect failures when the ``DeploymentController`` is set to ``ECS``.
For more information, see `Rolling update <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-
ecs.html>`_ in the **Amazon Elastic Container Service Developer Guide** .
"""
alarmNames: "builtins.list[str]"
"""
One or more CloudWatch alarm names.
Use a "," to separate the alarms.
"""
rollback: bool
"""
Determines whether to configure Amazon ECS to roll back the service if a service
deployment fails.
If rollback is used, when a service deployment fails, the service is rolled back to
the last deployment that completed successfully.
"""
enable: bool
"""
Determines whether to use the CloudWatch alarm option in the service deployment
process.
"""
[docs]class HookDetails(Boto3Model):
pass
[docs]class DeploymentLifecycleHook(Boto3Model):
"""
A deployment lifecycle hook runs custom logic at specific stages of the deployment
process. Currently, you can use Lambda functions as hook targets.
For more information, see
`Lifecycle hooks for Amazon ECS service deployments <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-lifecycle-hooks.html>`_
in the
*Amazon Elastic Container Service Developer Guide*.
"""
hookTargetArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the hook target.
Currently, only Lambda function ARNs are supported.
"""
roleArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the IAM role that grants Amazon ECS permission to
call Lambda functions on your behalf.
"""
lifecycleStages: "builtins.list[Literal['RECONCILE_SERVICE', 'PRE_SCALE_UP', 'POST_SCALE_UP', 'TEST_TRAFFIC_SHIFT', 'POST_TEST_TRAFFIC_SHIFT', 'PRODUCTION_TRAFFIC_SHIFT', 'POST_PRODUCTION_TRAFFIC_SHIFT']] | None" = Field(
default_factory=list
)
"""
The lifecycle stages at which to run the hook.
Choose from these valid values:
"""
hookDetails: "HookDetails | None" = None
"""
Use this field to specify custom parameters that Amazon ECS will pass to your hook
target invocations (such as a Lambda function).
"""
[docs]class LinearConfiguration(Boto3Model):
"""
Configuration for linear deployment strategy that shifts production traffic in equal
percentage increments with configurable wait times between each step until 100% of
traffic is shifted to the new service revision.
This is only
valid when you run ``CreateService`` or ``UpdateService`` with ``deploymentController`` set to ``ECS`` and a
``deploymentConfiguration`` with a strategy set to ``LINEAR``.
"""
stepPercent: "float | None" = None
"""
The percentage of production traffic to shift in each step during a linear
deployment.
Valid values are multiples of 0.1 from 3.0 to 100.0. The default value is 10.0.
"""
stepBakeTimeInMinutes: "int | None" = None
"""
The amount of time in minutes to wait between each traffic shifting step during a
linear deployment.
Valid values are 0 to 1440 minutes (24 hours). The default value is 6. This bake
time is not applied after reaching 100 percent traffic.
"""
[docs]class CanaryConfiguration(Boto3Model):
"""
Configuration for a canary deployment strategy that shifts a fixed percentage of
traffic to the new service revision, waits for a specified bake time, then shifts
the remaining traffic.
This is only valid when you run ``CreateService`` or ``UpdateService`` with ``deploymentController`` set to ``ECS`` and
a ``deploymentConfiguration`` with a strategy set to ``CANARY``.
"""
canaryPercent: "float | None" = None
"""
The percentage of production traffic to shift to the new service revision during the
canary phase.
Valid values are multiples of 0.1 from 0.1 to 100.0. The default value is 5.0.
"""
canaryBakeTimeInMinutes: "int | None" = None
"""
The amount of time in minutes to wait during the canary phase before shifting the
remaining production traffic to the new service revision.
Valid values are 0 to 1440 minutes (24 hours). The default value is 10.
"""
[docs]class DeploymentConfiguration(Boto3Model):
"""
Optional deployment parameters that control how many tasks run during a deployment
and the ordering of stopping and starting tasks.
"""
deploymentCircuitBreaker: "DeploymentCircuitBreaker | None" = None
"""
The deployment circuit breaker can only be used for services using the rolling
update (``ECS``) deployment type.
"""
maximumPercent: "int | None" = None
"""
If a service is using the rolling update (``ECS``) deployment type, the
``maximumPercent`` parameter represents an upper limit on the number of your
service's tasks that are allowed in the ``RUNNING`` or ``PENDING`` state during a
deployment, as a percentage of the ``desiredCount`` (rounded down to the nearest
integer).
This parameter enables you to
define the deployment batch size. For example, if your service is using the ``REPLICA`` service scheduler and has a
``desiredCount`` of four tasks and a ``maximumPercent`` value of 200%, the scheduler may start four new tasks before
stopping the four older tasks (provided that the cluster resources required to do this are available). The default
``maximumPercent`` value for a service using the ``REPLICA`` service scheduler is 200%.
"""
minimumHealthyPercent: "int | None" = None
"""
If a service is using the rolling update (``ECS``) deployment type, the
``minimumHealthyPercent`` represents a lower limit on the number of your service's
tasks that must remain in the ``RUNNING`` state during a deployment, as a percentage
of the ``desiredCount`` (rounded up to the nearest integer).
This parameter enables you to deploy without
using additional cluster capacity. For example, if your service has a ``desiredCount`` of four tasks and a
``minimumHealthyPercent`` of 50%, the service scheduler may stop two existing tasks to free up cluster capacity before
starting two new tasks.
"""
alarms: "DeploymentAlarms | None" = None
"""
Information about the CloudWatch alarms.
"""
strategy: "Literal['ROLLING', 'BLUE_GREEN', 'LINEAR', 'CANARY'] | None" = None
"""
The deployment strategy for the service.
Choose from these valid values:
"""
bakeTimeInMinutes: "int | None" = None
"""
The time period when both blue and green service revisions are running
simultaneously after the production traffic has shifted.
"""
lifecycleHooks: "builtins.list[DeploymentLifecycleHook] | None" = Field(
default_factory=list
)
"""
An array of deployment lifecycle hook objects to run custom logic at specific stages
of the deployment lifecycle.
"""
linearConfiguration: "LinearConfiguration | None" = None
"""
Configuration for linear deployment strategy.
Only valid when the deployment strategy is ``LINEAR``. This configuration
enables progressive traffic shifting in equal percentage increments with configurable bake times between each step.
"""
canaryConfiguration: "CanaryConfiguration | None" = None
"""
Configuration for canary deployment strategy.
Only valid when the deployment strategy is ``CANARY``. This configuration
enables shifting a fixed percentage of traffic for testing, followed by shifting the remaining traffic after a bake
period.
"""
[docs]class AwsVpcConfiguration(Boto3Model):
"""
An object representing the networking details for a task or service.
For example
``awsVpcConfiguration={subnets=["subnet-12344321"],securityGroups=["sg-12344321"]}``.
"""
subnets: "builtins.list[str]"
"""
The IDs of the subnets associated with the task or service.
There's a limit of 16 subnets that can be specified.
"""
securityGroups: "builtins.list[str] | None" = Field(default_factory=list)
"""
The IDs of the security groups associated with the task or service.
If you don't specify a security group, the default security group for the VPC is
used. There's a limit of 5 security groups that can be specified.
"""
assignPublicIp: "Literal['ENABLED', 'DISABLED'] | None" = None
"""
Whether the task's elastic network interface receives a public IP address.
"""
[docs]class NetworkConfiguration(Boto3Model):
"""
The network configuration for a task or service.
"""
awsvpcConfiguration: "AwsVpcConfiguration | None" = None
"""
The VPC subnets and security groups that are associated with a task.
"""
[docs]class Scale(Boto3Model):
"""
A floating-point percentage of the desired number of tasks to place and keep running
in the task set.
"""
value: "float | None" = None
"""
The value, specified as a percent total of a service's ``desiredCount``, to scale
the task set.
Accepted values are numbers between 0 and 100.
"""
unit: "Literal['PERCENT'] | None" = None
"""
The unit of measure for the scale value.
"""
[docs]class DeploymentEphemeralStorage(Boto3Model):
"""
The amount of ephemeral storage to allocate for the deployment.
"""
kmsKeyId: "str | None" = None
"""
Specify an Key Management Service key ID to encrypt the ephemeral storage for
deployment.
"""
[docs]class TaskSet(TagsDictMixin, PrimaryBoto3Model):
"""
Information about a set of Amazon ECS tasks in either an CodeDeploy or an
``EXTERNAL`` deployment.
An Amazon ECS task set includes details such as the desired number of tasks, how
many tasks are running, and whether the task set serves production traffic.
"""
tag_class: ClassVar[type[Boto3Model]] = ECSTag
manager_class: ClassVar[type[Boto3ModelManager]] = TaskSetManager
Tags: "builtins.list[ECSTag]" = Field(default_factory=list, alias="tags")
"""
The metadata that you apply to the task set to help you categorize and organize
them.
Each tag consists of a key and an optional value. You define both.
"""
id: str = Field(default=None, frozen=True)
"""
The ID of the task set.
"""
taskSetArn: str = Field(default=None, frozen=True)
"""
The Amazon Resource Name (ARN) of the task set.
"""
serviceArn: str = Field(default=None, frozen=True)
"""
The Amazon Resource Name (ARN) of the service the task set exists in.
"""
clusterArn: str = Field(default=None, frozen=True)
"""
The Amazon Resource Name (ARN) of the cluster that the service that hosts the task
set exists in.
"""
startedBy: str = Field(default=None, frozen=True)
"""
The tag specified when a task set is started.
If an CodeDeploy deployment created the task set, the ``startedBy``
parameter is ``CODE_DEPLOY``. If an external deployment created the task set, the ``startedBy`` field isn't used.
"""
externalId: "str | None" = None
"""
The external ID associated with the task set.
"""
status: str = Field(default=None, frozen=True)
"""
The status of the task set.
The following describes each state.
"""
taskDefinition: "str | None" = None
"""
The task definition that the task set is using.
"""
computedDesiredCount: int = Field(default=None, frozen=True)
"""
The computed desired count for the task set.
This is calculated by multiplying the service's ``desiredCount`` by the
task set's ``scale`` percentage. The result is always rounded up. For example, if the computed desired count is 1.2, it
rounds up to 2 tasks.
"""
pendingCount: int = Field(default=None, frozen=True)
"""
The number of tasks in the task set that are in the ``PENDING`` status during a
deployment.
A task in the ``PENDING``
state is preparing to enter the ``RUNNING`` state. A task set enters the ``PENDING`` status when it launches for the
first time or when it's restarted after being in the ``STOPPED`` state.
"""
runningCount: int = Field(default=None, frozen=True)
"""
The number of tasks in the task set that are in the ``RUNNING`` status during a
deployment.
A task in the ``RUNNING``
state is running and ready for use.
"""
createdAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the task set was created.
"""
updatedAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the task set was last updated.
"""
launchType: "Literal['EC2', 'FARGATE', 'EXTERNAL', 'MANAGED_INSTANCES'] | None" = (
None
)
"""
The launch type the tasks in the task set are using.
For more information, see
`Amazon ECS launch types <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html>`_
in the *Amazon Elastic Container
Service Developer Guide*.
"""
capacityProviderStrategy: "builtins.list[CapacityProviderStrategyItem] | None" = (
Field(default_factory=list)
)
"""
The capacity provider strategy that are associated with the task set.
"""
platformVersion: "str | None" = None
"""
The Fargate platform version where the tasks in the task set are running.
A platform version is only specified for tasks run on Fargate. For more information,
see
`Fargate platform versions <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html>`_
in the *Amazon Elastic
Container Service Developer Guide*.
"""
platformFamily: str = Field(default=None, frozen=True)
"""
The operating system that your tasks in the set are running on.
A platform family is specified only for tasks that use the Fargate launch type.
"""
networkConfiguration: "NetworkConfiguration | None" = None
"""
The network configuration for the task set.
"""
loadBalancers: "builtins.list[LoadBalancerConfiguration] | None" = Field(
default_factory=list
)
"""
Details on a load balancer that are used with a task set.
"""
serviceRegistries: "builtins.list[ServiceRegistry] | None" = Field(
default_factory=list
)
"""
The details for the service discovery registries to assign to this task set.
For more information, see
`Service discovery <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-discovery.html>`_.
"""
scale: "Scale | None" = None
"""
A floating-point percentage of your desired number of tasks to place and keep
running in the task set.
"""
stabilityStatus: Literal["STEADY_STATE", "STABILIZING"] = Field(
default=None, frozen=True
)
"""
The stability status.
This indicates whether the task set has reached a steady state. If the following conditions are
met, the task set are in ``STEADY_STATE``:
"""
stabilityStatusAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the task set stability status was retrieved.
"""
fargateEphemeralStorage: DeploymentEphemeralStorage = Field(
default=None, frozen=True
)
"""
The Fargate ephemeral storage settings for the task set.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`taskSetArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.taskSetArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`taskSetArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.taskSetArn
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`taskSetArn` attribute.
"""
return hash(self.taskSetArn)
@cached_property
def service(self) -> "Service | None":
"""
Return the :py:class:`Service` object that owns this task set, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"service": self.serviceArn,
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return Service.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def cluster(self) -> "Cluster | None":
"""
Return the :py:class:`Cluster` object that owns this task set, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return Cluster.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def task_definition(self) -> "TaskDefinition | None":
"""
Return the :py:class:`TaskDefinition` object for this task set, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"taskDefinition": self.taskDefinition,
}
)
except AttributeError:
return None
return TaskDefinition.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs]class ServiceConnectTestTrafficRules(Boto3Model):
"""
The test traffic routing configuration for Amazon ECS blue/green deployments. This
configuration allows you to define rules for routing specific traffic to the new
service revision during the deployment process, allowing for safe testing before
full production traffic shift.
For more information, see `Service Connect for Amazon ECS blue/green
deployments <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-connect-blue-green.html>`_ in the
*Amazon Elastic Container Service Developer Guide*.
"""
header: ServiceConnectTestTrafficHeaderRules
"""
The HTTP header-based routing rules that determine which requests should be routed
to the new service version during blue/green deployment testing.
These rules provide fine-grained control over test traffic routing based on request
headers.
"""
[docs]class ServiceConnectClientAlias(Boto3Model):
"""
Each alias ("endpoint") is a fully-qualified name and port number that other tasks
("clients") can use to connect to this service.
Each name and port mapping must be unique within the namespace.
Tasks that run in a namespace can use short names to connect to services in the
namespace. Tasks can connect to services across all of the clusters in the
namespace. Tasks connect through a managed proxy container that collects logs and
metrics for increased visibility. Only the tasks that Amazon ECS services create are
supported with Service Connect. For more information, see
`Service Connect <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-
connect.html>`_ in the *Amazon Elastic Container Service Developer Guide*.
"""
port: int
"""
The listening port number for the Service Connect proxy.
This port is available inside of all of the tasks within the same namespace.
"""
dnsName: "str | None" = None
"""
The ``dnsName`` is the name that you use in the applications of client tasks to
connect to this service.
The name must be a valid DNS name but doesn't need to be fully-qualified. The name
can include up to 127 characters. The name can include lowercase letters, numbers,
underscores (_), hyphens (-), and periods (.). The name can't start with a hyphen.
"""
testTrafficRules: "ServiceConnectTestTrafficRules | None" = None
"""
The configuration for test traffic routing rules used during blue/green deployments
with Amazon ECS Service Connect.
This allows you to route a portion of traffic to the new service revision of your
service for testing before shifting all production traffic.
"""
[docs]class TimeoutConfiguration(Boto3Model):
"""
An object that represents the timeout configurations for Service Connect.
If ``idleTimeout`` is set to a time that is less than ``perRequestTimeout``, the connection will close when the
``idleTimeout`` is reached and not the ``perRequestTimeout``.
"""
idleTimeoutSeconds: "int | None" = None
"""
The amount of time in seconds a connection will stay active while idle.
A value of ``0`` can be set to disable
``idleTimeout``.
"""
perRequestTimeoutSeconds: "int | None" = None
"""
The amount of time waiting for the upstream to respond with a complete response per
request.
A value of ``0`` can be set
to disable ``perRequestTimeout``. ``perRequestTimeout`` can only be set if Service Connect ``appProtocol`` isn't
``TCP``. Only ``idleTimeout`` is allowed for ``TCP`` ``appProtocol``.
"""
[docs]class ServiceConnectTlsCertificateAuthority(Boto3Model):
"""
The certificate root authority that secures your service.
"""
awsPcaAuthorityArn: "str | None" = None
"""
The ARN of the Amazon Web Services Private Certificate Authority certificate.
"""
[docs]class ServiceConnectTlsConfiguration(Boto3Model):
"""
The key that encrypts and decrypts your resources for Service Connect TLS.
"""
issuerCertificateAuthority: ServiceConnectTlsCertificateAuthority
"""
The signer certificate authority.
"""
kmsKey: "str | None" = None
"""
The Amazon Web Services Key Management Service key.
"""
roleArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the IAM role that's associated with the Service
Connect TLS.
"""
[docs]class ServiceConnectService(Boto3Model):
"""
The Service Connect service object configuration.
For more information, see
`Service Connect <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-connect.html>`_
in the *Amazon Elastic
Container Service Developer Guide*.
"""
portName: str
"""
The ``portName`` must match the name of one of the ``portMappings`` from all the
containers in the task definition of this Amazon ECS service.
"""
discoveryName: "str | None" = None
"""
The ``discoveryName`` is the name of the new Cloud Map service that Amazon ECS
creates for this Amazon ECS service.
This must be unique within the Cloud Map namespace. The name can contain up to 64
characters. The name can include lowercase letters, numbers, underscores (_), and
hyphens (-). The name can't start with a hyphen.
"""
clientAliases: "builtins.list[ServiceConnectClientAlias] | None" = Field(
default_factory=list
)
"""
The list of client aliases for this Service Connect service.
You use these to assign names that can be used by client applications. The maximum
number of client aliases that you can have in this list is 1.
"""
ingressPortOverride: "int | None" = None
"""
The port number for the Service Connect proxy to listen on.
"""
timeout: "TimeoutConfiguration | None" = None
"""
A reference to an object that represents the configured timeouts for Service
Connect.
"""
tls: "ServiceConnectTlsConfiguration | None" = None
"""
A reference to an object that represents a Transport Layer Security (TLS)
configuration.
"""
[docs]class ECSContainerDefinitionSecret(Boto3Model):
"""An object representing the secret to expose to your container. Secrets can be exposed to a container in the following
ways:
* To inject sensitive data into your containers as environment variables, use the ``secrets`` container definition
parameter.
* To reference sensitive information in the log configuration of a container, use the ``secretOptions`` container
definition parameter.
For more information, see `Specifying sensitive
data <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html>`_ in the *Amazon Elastic
Container Service Developer Guide*.
"""
name: str
"""
The name of the secret.
"""
valueFrom: str
"""
The secret to expose to the container.
The supported values are either the full ARN of the Secrets Manager secret or the
full ARN of the parameter in the SSM Parameter Store.
"""
[docs]class LogConfiguration(Boto3Model):
"""
The log configuration for the container. This parameter maps to ``LogConfig`` in the
docker container create command and the ``--log-driver`` option to docker run.
By default, containers use the same logging driver that the Docker daemon uses. However, the container might use a
different logging driver than the Docker daemon by specifying a log driver configuration in the container definition.
Understand the following when specifying a log configuration for your containers.
* Amazon ECS currently supports a subset of the logging drivers available to the Docker daemon. Additional log drivers
may be available in future releases of the Amazon ECS container agent.
For tasks on Fargate, the supported log drivers are ``awslogs``, ``splunk``, and ``awsfirelens``.
For tasks hosted on Amazon EC2 instances, the supported log drivers are ``awslogs``, ``fluentd``, ``gelf``, ``json-
file``, ``journald``,``syslog``, ``splunk``, and ``awsfirelens``.
* This parameter requires version 1.18 of the Docker Remote API or greater on your container instance.
* For tasks that are hosted on Amazon EC2 instances, the Amazon ECS container agent must register the available logging
drivers with the ``ECS_AVAILABLE_LOGGING_DRIVERS`` environment variable before containers placed on that instance can
use these log configuration options. For more information, see `Amazon ECS container agent
configuration <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html>`_ in the *Amazon Elastic
Container Service Developer Guide*.
* For tasks that are on Fargate, because you don't have access to the underlying infrastructure your tasks are hosted
on, any additional software needed must be installed outside of the task. For example, the Fluentd output aggregators or
a remote host running Logstash to send Gelf logs to.
"""
logDriver: Literal[
"json-file",
"syslog",
"journald",
"gelf",
"fluentd",
"awslogs",
"splunk",
"awsfirelens",
]
"""
The log driver to use for the container.
"""
options: "dict[str, str] | None" = Field(default_factory=dict)
"""
The configuration options to send to the log driver.
"""
secretOptions: "builtins.list[ECSContainerDefinitionSecret] | None" = Field(
default_factory=list
)
"""
The secrets to pass to the log configuration.
For more information, see
`Specifying sensitive data <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html>`_
in the *Amazon Elastic
Container Service Developer Guide*.
"""
[docs]class ServiceConnectAccessLogConfiguration(Boto3Model):
"""
Configuration for Service Connect access logging. Access logs provide detailed
information about requests made to your service, including request patterns,
response codes, and timing data for debugging and monitoring purposes.
To enable access logs, you must also specify a ``logConfiguration`` in the ``serviceConnectConfiguration``.
"""
format: Literal["TEXT", "JSON"]
"""
The format for Service Connect access log output.
Choose TEXT for human-readable logs or JSON for structured data that integrates well
with log analysis tools.
"""
includeQueryParameters: "Literal['DISABLED', 'ENABLED'] | None" = None
"""
Specifies whether to include query parameters in Service Connect access logs.
"""
[docs]class ServiceConnectConfiguration(Boto3Model):
"""
The Service Connect configuration of your Amazon ECS service. The configuration for
this service to discover and connect to services, and be discovered by, and
connected from, other services within a namespace.
Tasks that run in a namespace can use short names to connect to services in the
namespace. Tasks can connect to services across all of the clusters in the
namespace. Tasks connect through a managed proxy container that collects logs and
metrics for increased visibility. Only the tasks that Amazon ECS services create are
supported with Service Connect. For more information, see
`Service Connect <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-
connect.html>`_ in the *Amazon Elastic Container Service Developer Guide*.
"""
enabled: bool
"""
Specifies whether to use Service Connect with this service.
"""
namespace: "str | None" = None
"""
The namespace name or full Amazon Resource Name (ARN) of the Cloud Map namespace for
use with Service Connect.
The namespace must be in the same Amazon Web Services Region as the Amazon ECS
service and cluster. The type of namespace doesn't affect Service Connect. For more
information about Cloud Map, see
`Working with Services <https://docs.aws.amazon.com/cloud-map/latest/dg/working-with-services.html>`_
in the *Cloud Map Developer
Guide*.
"""
services: "builtins.list[ServiceConnectService] | None" = Field(
default_factory=list
)
"""
The list of Service Connect service objects.
These are names and aliases (also known as endpoints) that are used by other Amazon
ECS services to connect to this service.
"""
logConfiguration: "LogConfiguration | None" = None
"""
The log configuration for the container.
This parameter maps to ``LogConfig`` in the docker container create command and
the ``--log-driver`` option to docker run.
"""
accessLogConfiguration: "ServiceConnectAccessLogConfiguration | None" = None
"""
The configuration for Service Connect access logging.
Access logs capture detailed information about requests made to your service,
including request patterns, response codes, and timing data. They can be useful for
debugging connectivity issues, monitoring service performance, and auditing service-
to-service communication for security and compliance purposes.
"""
[docs]class ServiceConnectServiceResource(Boto3Model):
"""
The Service Connect resource. Each configuration maps a discovery name to a Cloud
Map service name. The data is stored in Cloud Map as part of the Service Connect
configuration for each discovery name of this Amazon ECS service.
A task can resolve the ``dnsName`` for each of the ``clientAliases`` of a service. However a task can't resolve the
discovery names. If you want to connect to a service, refer to the ``ServiceConnectConfiguration`` of that service for
the list of ``clientAliases`` that you can use.
"""
discoveryName: "str | None" = None
"""
The discovery name of this Service Connect resource.
"""
discoveryArn: "str | None" = None
"""
The Amazon Resource Name (ARN) for the service in Cloud Map that matches the
discovery name for this Service Connect resource.
You can use this ARN in other integrations with Cloud Map. However, Service Connect
can't ensure connectivity outside of Amazon ECS.
"""
[docs]class ServiceManagedEBSVolumeConfiguration(Boto3Model):
"""The configuration for the Amazon EBS volume that Amazon ECS creates and manages on your behalf. These settings are used
to create each Amazon EBS volume, with one volume created for each task in the service. For information about the
supported launch types and operating systems, see `Supported operating systems and launch
types <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ebs-volumes.html#ebs-volumes-configuration>`_ in the
*Amazon Elastic Container Service Developer Guide*.
Many of these parameters map 1:1 with the Amazon EBS ``CreateVolume`` API request parameters.
"""
encrypted: "bool | None" = None
"""
Indicates whether the volume should be encrypted.
If you turn on Region-level Amazon EBS encryption by default but set
this value as ``false``, the setting is overridden and the volume is encrypted with the KMS key specified for Amazon EBS
encryption by default. This parameter maps 1:1 with the ``Encrypted`` parameter of the `CreateVolume
API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html>`_ in the *Amazon EC2 API Reference*.
"""
kmsKeyId: "str | None" = None
"""
The Amazon Resource Name (ARN) identifier of the Amazon Web Services Key Management
Service key to use for Amazon EBS encryption.
When a key is specified using this parameter, it overrides Amazon EBS default encryption or any KMS key that
you specified for cluster-level managed storage encryption. This parameter maps 1:1 with the ``KmsKeyId`` parameter of
the `CreateVolume API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html>`_ in the *Amazon EC2
API Reference*. For more information about encrypting Amazon EBS volumes attached to tasks, see `Encrypt data stored in
Amazon EBS volumes attached to Amazon ECS tasks <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ebs-kms-
encryption.html>`_.
"""
volumeType: "str | None" = None
"""
The volume type.
This parameter maps 1:1 with the ``VolumeType`` parameter of the `CreateVolume
API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html>`_ in the *Amazon EC2 API Reference*.
For more information, see `Amazon EBS volume types <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-
types.html>`_ in the *Amazon EC2 User Guide*.
"""
sizeInGiB: "int | None" = None
"""
The size of the volume in GiB.
You must specify either a volume size or a snapshot ID. If you specify a snapshot ID, the
snapshot size is used for the volume size by default. You can optionally specify a volume size greater than or equal to
the snapshot size. This parameter maps 1:1 with the ``Size`` parameter of the `CreateVolume
API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html>`_ in the *Amazon EC2 API Reference*.
"""
snapshotId: "str | None" = None
"""
The snapshot that Amazon ECS uses to create volumes for attachment to tasks
maintained by the service.
You must specify
either ``snapshotId`` or ``sizeInGiB`` in your volume configuration. This parameter maps 1:1 with the ``SnapshotId``
parameter of the `CreateVolume API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html>`_ in the
*Amazon EC2 API Reference*.
"""
volumeInitializationRate: "int | None" = None
"""
The rate, in MiB/s, at which data is fetched from a snapshot of an existing EBS
volume to create new volumes for attachment to the tasks maintained by the service.
This property can be specified only if you specify a ``snapshotId``.
For more information, see `Initialize Amazon EBS volumes <https://docs.aws.amazon.com/ebs/latest/userguide/initalize-
volume.html>`_ in the *Amazon EBS User Guide*.
"""
iops: "int | None" = None
"""
The number of I/O operations per second (IOPS).
For ``gp3``, ``io1``, and ``io2`` volumes, this represents the number of
IOPS that are provisioned for the volume. For ``gp2`` volumes, this represents the baseline performance of the volume
and the rate at which the volume accumulates I/O credits for bursting.
"""
throughput: "int | None" = None
"""
The throughput to provision for a volume, in MiB/s, with a maximum of 1,000 MiB/s.
This parameter maps 1:1 with the
``Throughput`` parameter of the `CreateVolume
API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html>`_ in the *Amazon EC2 API Reference*.
"""
tagSpecifications: "builtins.list[EBSTagSpecification] | None" = Field(
default_factory=list
)
"""
The tags to apply to the volume.
Amazon ECS applies service-managed tags by default. This parameter maps 1:1 with the
``TagSpecifications.N`` parameter of the `CreateVolume
API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html>`_ in the *Amazon EC2 API Reference*.
"""
roleArn: str
"""
The ARN of the IAM role to associate with this volume.
This is the Amazon ECS infrastructure IAM role that is used to
manage your Amazon Web Services infrastructure. We recommend using the Amazon ECS-managed
``AmazonECSInfrastructureRolePolicyForVolumes`` IAM policy with this role. For more information, see `Amazon ECS
infrastructure IAM role <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/infrastructure_IAM_role.html>`_ in
the *Amazon ECS Developer Guide*.
"""
filesystemType: "Literal['ext3', 'ext4', 'xfs', 'ntfs'] | None" = None
"""
The filesystem type for the volume.
For volumes created from a snapshot, you must specify the same filesystem type that
the volume was using when the snapshot was created. If there is a filesystem type
mismatch, the tasks will fail to start.
"""
[docs]class ServiceVolumeConfiguration(Boto3Model):
"""
The configuration for a volume specified in the task definition as a volume that is
configured at launch time.
Currently, the only supported volume type is an Amazon EBS volume.
"""
name: str
"""
The name of the volume.
This value must match the volume name from the ``Volume`` object in the task definition.
"""
managedEBSVolume: "ServiceManagedEBSVolumeConfiguration | None" = None
"""
The configuration for the Amazon EBS volume that Amazon ECS creates and manages on
your behalf.
These settings are used to create each Amazon EBS volume, with one volume created
for each task in the service. The Amazon EBS volumes are visible in your account in
the Amazon EC2 console once they are created.
"""
[docs]class VpcLatticeConfiguration(Boto3Model):
"""
The VPC Lattice configuration for your service that holds the information for the
target group(s) Amazon ECS tasks will be registered to.
"""
roleArn: str
"""
The ARN of the IAM role to associate with this VPC Lattice configuration.
This is the Amazon ECS infrastructure IAM role that is used to manage your VPC
Lattice infrastructure.
"""
targetGroupArn: str
"""
The full Amazon Resource Name (ARN) of the target group or groups associated with
the VPC Lattice configuration that the Amazon ECS tasks will be registered to.
"""
portName: str
"""
The name of the port mapping to register in the VPC Lattice target group.
This is the name of the ``portMapping`` you
defined in your task definition.
"""
[docs]class Deployment(ReadonlyBoto3Model):
"""
The details of an Amazon ECS service deployment.
This is used only when a service uses the ``ECS`` deployment controller
type.
"""
id: "str | None" = None
"""
The ID of the deployment.
"""
status: "str | None" = None
"""
The status of the deployment.
The following describes each state.
"""
taskDefinition: "str | None" = None
"""
The most recent task definition that was specified for the tasks in the service to
use.
"""
desiredCount: "int | None" = None
"""
The most recent desired count of tasks that was specified for the service to deploy
or maintain.
"""
pendingCount: "int | None" = None
"""
The number of tasks in the deployment that are in the ``PENDING`` status.
"""
runningCount: "int | None" = None
"""
The number of tasks in the deployment that are in the ``RUNNING`` status.
"""
failedTasks: "int | None" = None
"""
The number of consecutively failed tasks in the deployment.
A task is considered a failure if the service scheduler
can't launch the task, the task doesn't transition to a ``RUNNING`` state, or if it fails any of its defined health
checks and is stopped.
"""
createdAt: "datetime | None" = None
"""
The Unix timestamp for the time when the service deployment was created.
"""
updatedAt: "datetime | None" = None
"""
The Unix timestamp for the time when the service deployment was last updated.
"""
capacityProviderStrategy: "builtins.list[CapacityProviderStrategyItem] | None" = (
Field(default_factory=list)
)
"""
The capacity provider strategy that the deployment is using.
"""
launchType: "Literal['EC2', 'FARGATE', 'EXTERNAL', 'MANAGED_INSTANCES'] | None" = (
None
)
"""
The launch type the tasks in the service are using.
For more information, see
`Amazon ECS Launch Types <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html>`_
in the *Amazon Elastic Container
Service Developer Guide*.
"""
platformVersion: "str | None" = None
"""
The platform version that your tasks in the service run on.
A platform version is only specified for tasks using the
Fargate launch type. If one isn't specified, the ``LATEST`` platform version is used. For more information, see `Fargate
Platform Versions <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html>`_ in the *Amazon
Elastic Container Service Developer Guide*.
"""
platformFamily: "str | None" = None
"""
The operating system that your tasks in the service, or tasks are running on.
A platform family is specified only for tasks using the Fargate launch type.
"""
networkConfiguration: "NetworkConfiguration | None" = None
"""
The VPC subnet and security group configuration for tasks that receive their own
elastic network interface by using the ``awsvpc`` networking mode.
"""
rolloutState: "Literal['COMPLETED', 'FAILED', 'IN_PROGRESS'] | None" = None
"""
The ``rolloutState`` of a service is only returned for services that use the rolling
update (``ECS``) deployment type that aren't behind a Classic Load Balancer.
"""
rolloutStateReason: "str | None" = None
"""
A description of the rollout state of a deployment.
"""
serviceConnectConfiguration: "ServiceConnectConfiguration | None" = None
"""
The details of the Service Connect configuration that's used by this deployment.
Compare the configuration between multiple deployments when troubleshooting issues
with new deployments.
"""
serviceConnectResources: "builtins.list[ServiceConnectServiceResource] | None" = (
Field(default_factory=list)
)
"""
The list of Service Connect resources that are associated with this deployment.
Each list entry maps a discovery name to a Cloud Map service name.
"""
volumeConfigurations: "builtins.list[ServiceVolumeConfiguration] | None" = Field(
default_factory=list
)
"""
The details of the volume that was ``configuredAtLaunch``.
You can configure different settings like the size,
throughput, volumeType, and ecryption in `ServiceManagedEBSVolumeConfiguration <https://docs.aws.amazon.com/AmazonECS/la
test/APIReference/API_ServiceManagedEBSVolumeConfiguration.html>`_. The ``name`` of the volume must match the ``name``
from the task definition.
"""
fargateEphemeralStorage: "DeploymentEphemeralStorage | None" = None
"""
The Fargate ephemeral storage settings for the deployment.
"""
vpcLatticeConfigurations: "builtins.list[VpcLatticeConfiguration] | None" = Field(
default_factory=list
)
"""
The VPC Lattice configuration for the service deployment.
"""
[docs]class ServiceEvent(Boto3Model):
"""
The details for an event that's associated with a service.
"""
id: "str | None" = None
"""
The ID string for the event.
"""
createdAt: "datetime | None" = None
"""
The Unix timestamp for the time when the event was triggered.
"""
message: "str | None" = None
"""
The event message.
"""
[docs]class ServiceCurrentRevisionSummary(Boto3Model):
"""
The summary of the current service revision configuration.
"""
arn: "str | None" = None
"""
The ARN of the current service revision.
"""
requestedTaskCount: "int | None" = None
"""
The number of requested tasks in the current service revision.
"""
runningTaskCount: "int | None" = None
"""
The number of running tasks of the current service revision.
"""
pendingTaskCount: "int | None" = None
"""
The number of pending tasks in the current service revision.
"""
[docs]class PlacementConstraint(Boto3Model):
"""An object representing a constraint on task placement. For more information, see `Task placement
constraints <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html>`_ in the *Amazon
Elastic Container Service Developer Guide*.
If you're using the Fargate launch type, task placement constraints aren't supported.
"""
type: "Literal['distinctInstance', 'memberOf'] | None" = None
"""
The type of constraint.
Use ``distinctInstance`` to ensure that each task in a particular group is running on a
different container instance. Use ``memberOf`` to restrict the selection to a group of valid candidates.
"""
expression: "str | None" = None
"""
A cluster query language expression to apply to the constraint.
The expression can have a maximum length of 2000
characters. You can't specify an expression if the constraint type is ``distinctInstance``. For more information, see
`Cluster query language <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query-language.html>`_ in the
*Amazon Elastic Container Service Developer Guide*.
"""
[docs]class PlacementStrategy(Boto3Model):
"""
The task placement strategy for a task or service.
For more information, see
`Task placement strategies <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html>`_
in the *Amazon
Elastic Container Service Developer Guide*.
"""
type: "Literal['random', 'spread', 'binpack'] | None" = None
"""
The type of placement strategy.
The ``random`` placement strategy randomly places tasks on available candidates. The
``spread`` placement strategy spreads placement across available candidates evenly based on the ``field`` parameter. The
``binpack`` strategy places tasks on available candidates that have the least available amount of the resource that's
specified with the ``field`` parameter. For example, if you binpack on memory, a task is placed on the instance with the
least amount of remaining memory but still enough to run the task.
"""
field: "str | None" = None
"""
The field to apply the placement strategy against.
For the ``spread`` placement strategy, valid values are
``instanceId`` (or ``host``, which has the same effect), or any platform or custom attribute that's applied to a
container instance, such as ``attribute:ecs.availability-zone``. For the ``binpack`` placement strategy, valid values
are ``cpu`` and ``memory``. For the ``random`` placement strategy, this field is not used.
"""
[docs]class DeploymentController(Boto3Model):
"""
The deployment controller to use for the service.
"""
type: Literal["ECS", "CODE_DEPLOY", "EXTERNAL"]
"""
The deployment controller type to use.
"""
[docs]class Service(TagsDictMixin, ECSServiceModelMixin, PrimaryBoto3Model):
"""
Details on a service within a cluster.
"""
tag_class: ClassVar[type[Boto3Model]] = ECSTag
manager_class: ClassVar[type[Boto3ModelManager]] = ServiceManager
serviceName: str
"""
The name of your service.
Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are
allowed. Service names must be unique within a cluster. However, you can have
similarly named services in multiple clusters within a Region or across multiple
Regions.
"""
taskDefinition: str
"""
The task definition to use for tasks in the service.
This value is specified when the service is created with
`CreateService <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_CreateService.html>`_,
and it can be modified with
`UpdateService <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html>`_.
"""
clusterArn: str
"""
The Amazon Resource Name (ARN) of the cluster that hosts the service.
"""
desiredCount: int
"""
The desired number of instantiations of the task definition to keep running on the
service.
This value is specified when the service is created with
`CreateService <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_CreateService.html>`_
, and it can be modified with
`UpdateService <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html>`_.
"""
launchType: Literal["EC2", "FARGATE", "EXTERNAL", "MANAGED_INSTANCES"]
"""
The launch type the service is using.
When using the DescribeServices API, this field is omitted if the service was
created using a capacity provider strategy.
"""
schedulingStrategy: Literal["REPLICA", "DAEMON"]
"""
The scheduling strategy to use for the service.
For more information, see
`Services <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html>`_.
"""
Tags: "builtins.list[ECSTag]" = Field(default_factory=list, alias="tags")
"""
The metadata that you apply to the service to help you categorize and organize them.
Each tag consists of a key and an optional value. You define bot the key and value.
"""
serviceArn: str = Field(default=None, frozen=True)
"""
The ARN that identifies the service.
For more information about the ARN format, see `Amazon Resource Name
(ARN) <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids>`_ in the
*Amazon ECS Developer Guide*.
"""
loadBalancers: "builtins.list[LoadBalancerConfiguration] | None" = Field(
default_factory=list
)
"""
A list of Elastic Load Balancing load balancer objects.
It contains the load balancer name, the container name, and the container port to
access from the load balancer. The container name is as it appears in a container
definition.
"""
serviceRegistries: "builtins.list[ServiceRegistry] | None" = Field(
default_factory=list
)
"""
The details for the service discovery registries to assign to this service.
For more information, see
`Service Discovery <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-discovery.html>`_.
"""
status: str = Field(default=None, frozen=True)
"""
The status of the service.
The valid values are ``ACTIVE``, ``DRAINING``, or ``INACTIVE``.
"""
runningCount: int = Field(default=None, frozen=True)
"""
The number of tasks in the cluster that are in the ``RUNNING`` state.
"""
pendingCount: int = Field(default=None, frozen=True)
"""
The number of tasks in the cluster that are in the ``PENDING`` state.
"""
capacityProviderStrategy: "builtins.list[CapacityProviderStrategyItem] | None" = (
Field(default_factory=list)
)
"""
The capacity provider strategy the service uses.
When using the DescribeServices API, this field is omitted if the service was
created using a launch type.
"""
platformVersion: "str | None" = None
"""
The platform version to run your service on.
A platform version is only specified for tasks that are hosted on Fargate.
If one isn't specified, the ``LATEST`` platform version is used. For more information, see `Fargate Platform
Versions <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html>`_ in the *Amazon Elastic
Container Service Developer Guide*.
"""
platformFamily: str = Field(default=None, frozen=True)
"""
The operating system that your tasks in the service run on.
A platform family is specified only for tasks using the Fargate launch type.
"""
deploymentConfiguration: "DeploymentConfiguration | None" = None
"""
Optional deployment parameters that control how many tasks run during the deployment
and the ordering of stopping and starting tasks.
"""
taskSets: "builtins.list[TaskSet]" = Field(default_factory=list, frozen=True)
"""
Information about a set of Amazon ECS tasks in either an CodeDeploy or an
``EXTERNAL`` deployment.
An Amazon ECS task set includes details such as the desired number of tasks, how
many tasks are running, and whether the task set serves production traffic.
"""
deployments: "builtins.list[Deployment]" = Field(default_factory=list, frozen=True)
"""
The current state of deployments for the service.
"""
roleArn: str = Field(default=None, frozen=True)
"""
The ARN of the IAM role that's associated with the service.
It allows the Amazon ECS container agent to register container instances with an
Elastic Load Balancing load balancer.
"""
events: "builtins.list[ServiceEvent]" = Field(default_factory=list, frozen=True)
"""
The event stream for your service.
A maximum of 100 of the latest events are displayed.
"""
createdAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the service was created.
"""
currentServiceDeployment: str = Field(default=None, frozen=True)
"""
The ARN of the current service deployment.
"""
currentServiceRevisions: "builtins.list[ServiceCurrentRevisionSummary]" = Field(
default_factory=list, frozen=True
)
"""
The list of the service revisions.
"""
placementConstraints: "builtins.list[PlacementConstraint] | None" = Field(
default_factory=list
)
"""
The placement constraints for the tasks in the service.
"""
placementStrategy: "builtins.list[PlacementStrategy] | None" = Field(
default_factory=list
)
"""
The placement strategy that determines how tasks for the service are placed.
"""
networkConfiguration: "NetworkConfiguration | None" = None
"""
The VPC subnet and security group configuration for tasks that receive their own
elastic network interface by using the ``awsvpc`` networking mode.
"""
healthCheckGracePeriodSeconds: "int | None" = None
"""
The period of time, in seconds, that the Amazon ECS service scheduler ignores
unhealthy Elastic Load Balancing, VPC Lattice, and container health checks after a
task has first started.
"""
deploymentController: "DeploymentController | None" = None
"""
The deployment controller type the service is using.
"""
createdBy: str = Field(default=None, frozen=True)
"""
The principal that created the service.
"""
enableECSManagedTags: "bool | None" = None
"""
Determines whether to use Amazon ECS managed tags for the tasks in the service.
For more information, see
`Tagging Your Amazon ECS Resources <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html>`_
in the *Amazon
Elastic Container Service Developer Guide*.
"""
propagateTags: "Literal['TASK_DEFINITION', 'SERVICE', 'NONE'] | None" = None
"""
Determines whether to propagate the tags from the task definition or the service to
the task.
If no value is specified, the tags aren't propagated.
"""
enableExecuteCommand: "bool | None" = None
"""
Determines whether the execute command functionality is turned on for the service.
If ``true``, the execute command
functionality is turned on for all containers in tasks as part of the service.
"""
availabilityZoneRebalancing: "Literal['ENABLED', 'DISABLED'] | None" = None
"""
Indicates whether to use Availability Zone rebalancing for the service.
"""
resourceManagementType: Literal["CUSTOMER", "ECS"] = Field(
default=None, frozen=True
)
"""
Identifies whether an ECS Service is an Express Service managed by ECS, or managed
by the customer.
The valid values are
``ECS`` and ``CUSTOMER``
"""
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`serviceArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.serviceArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`serviceName`
attribute.
Returns:
The name of the model instance.
"""
return self.serviceName
@property
def pk(self) -> OrderedDict[str, Any]:
"""
The primary key of the service.
This can be used to get the service with the :py:meth:`botocraft.services.ecs.ServiceManager.get` method, or to do :py:meth:`botocraft.services.ecs.ServiceManager.partial_update`.
"""
return OrderedDict(
{
"service": self.serviceName,
"cluster": self.clusterArn,
}
)
@property
def cluster_name(self) -> str | None:
"""
The name of the cluster that houses this service.
"""
return self.transform("clusterArn", r"^.*:cluster/(.+)$")
@cached_property
def cluster(self) -> "Cluster | None":
"""
Return the :py:class:`Cluster` object that this service belongs to, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return Cluster.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def task_definition(self) -> "TaskDefinition | None":
"""
Return the :py:class:`TaskDefinition` object that this service uses, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"taskDefinition": self.taskDefinition,
}
)
except AttributeError:
return None
return TaskDefinition.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@property
def tasks(self) -> "list[Task] | None":
"""
Return the ARNs of :py:class:`Task` objects that run in this service, if any.
"""
try:
pk = OrderedDict(
{
"serviceName": self.serviceName,
"cluster": self.clusterArn,
}
)
except AttributeError:
return []
return Task.objects.using(self.session).list(**pk) # type: ignore[arg-type]
@cached_property
def target_groups(self) -> "list[TargetGroup] | None":
"""
Return the target groups that are associated with this service, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"TargetGroupArns": [
lb.targetGroupArn
for lb in self.loadBalancers
if lb.targetGroupArn
],
}
)
except AttributeError:
return []
return TargetGroup.objects.using(self.session).list(**pk) # type: ignore[arg-type]
@cached_property
def scalable_targets(self) -> "list[ScalableTarget] | None":
"""
Return the scalable targets that are associated with this service, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"ServiceNamespace": "ecs",
"ResourceIds": f"service/{self.cluster_name}/{self.serviceName}",
}
)
except AttributeError:
return []
return ScalableTarget.objects.using(self.session).list(**pk) # type: ignore[arg-type]
@cached_property
def service_deployments(self) -> "list[ServiceDeployment] | None":
"""
Return the ARNs of :py:class:`ServiceDeployment` objects that run in this
service, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"service": self.serviceName,
"cluster": self.clusterArn,
}
)
except AttributeError:
return []
return ServiceDeployment.objects.using(self.session).list(**pk) # type: ignore[arg-type]
@cached_property
def current_service_deployment(self) -> "ServiceDeployment | None":
"""
Return the current :py:class:`ServiceDeployment` object for this service, if
any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"serviceDeploymentArn": self.currentServiceDeployment,
}
)
except AttributeError:
return None
return ServiceDeployment.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def current_service_revisions(self) -> "list[ServiceRevision] | None":
"""
Return the current :py:class:`ServiceRevision` objects for this service, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"serviceRevisionArns": [
revision.arn
for revision in self.currentServiceRevisions
if revision.arn
],
}
)
except AttributeError:
return []
return ServiceRevision.objects.using(self.session).list(**pk) # type: ignore[arg-type]
@cached_property
def task_sets(self) -> "list[TaskSet] | None":
"""
Return the :py:class:`TaskSet` objects associated with this service, if any.
Task sets are used only when the service deployment controller is ``EXTERNAL``;
services that use the ``ECS`` deployment controller do not populate
:py:attr:`taskSets` on describe responses, so this property is usually empty for
them.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"service": self.serviceName,
"cluster": self.clusterArn,
"taskSets": [
task_set.taskSetArn
for task_set in self.taskSets
if task_set.taskSetArn
],
}
)
except AttributeError:
return []
return TaskSet.objects.using(self.session).list(**pk) # type: ignore[arg-type]
[docs]class ExecuteCommandLogConfiguration(Boto3Model):
"""
The log configuration for the results of the execute command actions.
The logs can be sent to CloudWatch Logs or an Amazon S3 bucket.
"""
cloudWatchLogGroupName: "str | None" = None
"""
The name of the CloudWatch log group to send logs to.
"""
cloudWatchEncryptionEnabled: "bool | None" = None
"""
Determines whether to use encryption on the CloudWatch logs.
If not specified, encryption will be off.
"""
s3BucketName: "str | None" = None
"""
The name of the S3 bucket to send logs to.
"""
s3EncryptionEnabled: "bool | None" = None
"""
Determines whether to use encryption on the S3 logs.
If not specified, encryption is not used.
"""
s3KeyPrefix: "str | None" = None
"""
An optional folder in the S3 bucket to place logs in.
"""
[docs]class ExecuteCommandConfiguration(Boto3Model):
"""
The details of the execute command configuration.
"""
kmsKeyId: "str | None" = None
"""
Specify an Key Management Service key ID to encrypt the data between the local
client and the container.
"""
logging: "Literal['NONE', 'DEFAULT', 'OVERRIDE'] | None" = None
"""
The log setting to use for redirecting logs for your execute command results.
The following log settings are available.
"""
logConfiguration: "ExecuteCommandLogConfiguration | None" = None
"""
The log configuration for the results of the execute command actions.
The logs can be sent to CloudWatch Logs or an
Amazon S3 bucket. When ``logging=OVERRIDE`` is specified, a ``logConfiguration`` must be provided.
"""
[docs]class ManagedStorageConfiguration(Boto3Model):
"""
The managed storage configuration for the cluster.
"""
kmsKeyId: "str | None" = None
"""
Specify a Key Management Service key ID to encrypt Amazon ECS managed storage.
"""
fargateEphemeralStorageKmsKeyId: "str | None" = None
"""
Specify the Key Management Service key ID for Fargate ephemeral storage.
"""
[docs]class ClusterConfiguration(Boto3Model):
"""
The execute command and managed storage configuration for the cluster.
"""
executeCommandConfiguration: "ExecuteCommandConfiguration | None" = None
"""
The details of the execute command configuration.
"""
managedStorageConfiguration: "ManagedStorageConfiguration | None" = None
"""
The details of the managed storage configuration.
"""
[docs]class KeyValuePair(Boto3Model):
"""
A key-value pair object.
"""
name: "str | None" = None
"""
The name of the key-value pair.
For environment variables, this is the name of the environment variable.
"""
value: "str | None" = None
"""
The value of the key-value pair.
For environment variables, this is the value of the environment variable.
"""
[docs]class ClusterSetting(Boto3Model):
"""
The settings to use when creating a cluster. This parameter is used to turn on
CloudWatch Container Insights with enhanced observability or CloudWatch Container
Insights for a cluster.
Container Insights with enhanced observability provides all the Container Insights
metrics, plus additional task and container metrics. This version supports enhanced
observability for Amazon ECS clusters using the Amazon EC2 and Fargate launch types.
After you configure Container Insights with enhanced observability on Amazon ECS,
Container Insights auto- collects detailed infrastructure telemetry from the cluster
level down to the container level in your environment and displays these critical
performance data in curated dashboards removing the heavy lifting in observability
set-up.
For more information, see
`Monitor Amazon ECS containers using Container Insights with enhanced observability <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cloudwatch-container-insights.html>`_
in the
*Amazon Elastic Container Service Developer Guide*.
"""
name: "Literal['containerInsights'] | None" = None
"""
The name of the cluster setting.
The value is ``containerInsights``.
"""
value: "str | None" = None
"""
The value to set for the cluster setting.
The supported values are ``enhanced``, ``enabled``, and ``disabled``.
"""
[docs]class Attachment(Boto3Model):
"""
An object representing a container instance or task attachment.
"""
id: "str | None" = None
"""
The unique identifier for the attachment.
"""
type: "str | None" = None
"""
The type of the attachment, such as ``ElasticNetworkInterface``, ``Service
Connect``, and ``AmazonElasticBlockStorage``.
"""
status: "str | None" = None
"""
The status of the attachment.
Valid values are ``PRECREATED``, ``CREATED``, ``ATTACHING``, ``ATTACHED``, ``DETACHING``,
``DETACHED``, ``DELETED``, and ``FAILED``.
"""
details: "builtins.list[KeyValuePair] | None" = Field(default_factory=list)
"""
Details of the attachment.
"""
[docs]class ClusterServiceConnectDefaults(Boto3Model):
"""
Use this parameter to set a default Service Connect namespace. After you set a
default Service Connect namespace, any new services with Service Connect turned on
that are created in the cluster are added as client services in the namespace. This
setting only applies to new services that set the ``enabled`` parameter to ``true``
in the ``ServiceConnectConfiguration``. You can set the namespace of each service
individually in the ``ServiceConnectConfiguration`` to override this default
parameter.
Tasks that run in a namespace can use short names to connect to services in the
namespace. Tasks can connect to services across all of the clusters in the
namespace. Tasks connect through a managed proxy container that collects logs and
metrics for increased visibility. Only the tasks that Amazon ECS services create are
supported with Service Connect. For more information, see
`Service Connect <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-
connect.html>`_ in the *Amazon Elastic Container Service Developer Guide*.
"""
namespace: "str | None" = None
"""
The namespace name or full Amazon Resource Name (ARN) of the Cloud Map namespace.
When you create a service and don't specify a Service Connect configuration, this
namespace is used.
"""
[docs]class Cluster(TagsDictMixin, PrimaryBoto3Model):
"""
A regional grouping of one or more container instances where you can run task
requests.
Each account receives a default cluster the first time you use the Amazon ECS
service, but you may also create other clusters. Clusters may contain more than one
instance type simultaneously.
"""
tag_class: ClassVar[type[Boto3Model]] = ECSTag
manager_class: ClassVar[type[Boto3ModelManager]] = ClusterManager
clusterName: str
"""
A user-generated string that you use to identify your cluster.
"""
Tags: "builtins.list[ECSTag]" = Field(default_factory=list, alias="tags")
"""
The metadata that you apply to the cluster to help you categorize and organize them.
Each tag consists of a key and an optional value. You define both.
"""
clusterArn: str = Field(default=None, frozen=True)
"""
The Amazon Resource Name (ARN) that identifies the cluster.
For more information about the ARN format, see `Amazon
Resource Name (ARN) <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-
ids>`_ in the *Amazon ECS Developer Guide*.
"""
configuration: "ClusterConfiguration | None" = None
"""
The execute command and managed storage configuration for the cluster.
"""
status: str = Field(default=None, frozen=True)
"""
The status of the cluster.
The following are the possible states that are returned.
"""
registeredContainerInstancesCount: int = Field(default=None, frozen=True)
"""
The number of container instances registered into the cluster.
This includes container instances in both ``ACTIVE`` and
``DRAINING`` status.
"""
runningTasksCount: int = Field(default=None, frozen=True)
"""
The number of tasks in the cluster that are in the ``RUNNING`` state.
"""
pendingTasksCount: int = Field(default=None, frozen=True)
"""
The number of tasks in the cluster that are in the ``PENDING`` state.
"""
activeServicesCount: int = Field(default=None, frozen=True)
"""
The number of services that are running on the cluster in an ``ACTIVE`` state.
You can view these services with
`ListServices <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListServices.html>`_.
"""
statistics: "builtins.list[KeyValuePair]" = Field(default_factory=list, frozen=True)
"""
Additional information about your clusters that are separated by launch type.
They include the following:
"""
settings: "builtins.list[ClusterSetting] | None" = Field(default_factory=list)
"""
The settings for the cluster.
This parameter indicates whether CloudWatch Container Insights is on or off for a
cluster.
"""
capacityProviders: "builtins.list[str] | None" = Field(default_factory=list)
"""
The capacity providers associated with the cluster.
"""
defaultCapacityProviderStrategy: "builtins.list[CapacityProviderStrategyItem] | None" = Field(
default_factory=list
)
"""
The default capacity provider strategy for the cluster.
When services or tasks are run in the cluster with no launch type or capacity
provider strategy specified, the default capacity provider strategy is used.
"""
attachments: "builtins.list[Attachment]" = Field(default_factory=list, frozen=True)
"""
The resources attached to a cluster.
When using a capacity provider with a cluster, the capacity provider and associated
resources are returned as cluster attachments.
"""
attachmentsStatus: str = Field(default=None, frozen=True)
"""
The status of the capacity providers associated with the cluster.
The following are the states that are returned.
"""
serviceConnectDefaults: "ClusterServiceConnectDefaults | None" = None
"""
Use this parameter to set a default Service Connect namespace.
After you set a default Service Connect namespace, any
new services with Service Connect turned on that are created in the cluster are added as client services in the
namespace. This setting only applies to new services that set the ``enabled`` parameter to ``true`` in the
``ServiceConnectConfiguration``. You can set the namespace of each service individually in the
``ServiceConnectConfiguration`` to override this default parameter.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`clusterArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.clusterArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`clusterArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.clusterArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`clusterName`
attribute.
Returns:
The name of the model instance.
"""
return self.clusterName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`clusterArn` attribute.
"""
return hash(self.clusterArn)
@property
def cluster_name(self) -> str:
"""
The name of the cluster.
"""
return self.clusterName
@cached_property
def services(self) -> "list[Service] | None":
"""
Return the ARNs of :py:class:`Service` objects that run in this cluster, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"cluster": self.clusterArn,
}
)
except AttributeError:
return []
return Service.objects.using(self.session).list(**pk) # type: ignore[arg-type]
@cached_property
def container_instances(self) -> "list[ContainerInstance] | None":
"""
Return the ARNs of :py:class:`ContainerInstance` objects that run in this
cluster, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"cluster": self.clusterArn,
}
)
except AttributeError:
return []
return ContainerInstance.objects.using(self.session).list(**pk) # type: ignore[arg-type]
@cached_property
def capacity_providers(self) -> "list[CapacityProvider] | None":
"""
Return the :py:class:`CapacityProvider` objects associated with this cluster, if
any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"capacityProviders": self.capacityProviders,
"cluster": self.cluster_name,
}
)
except AttributeError:
return []
return CapacityProvider.objects.using(self.session).list(**pk) # type: ignore[arg-type]
[docs]class RepositoryCredentials(Boto3Model):
"""
The repository credentials for private registry authentication.
"""
credentialsParameter: str
"""
The Amazon Resource Name (ARN) of the secret containing the private repository
credentials.
"""
[docs]class PortMapping(Boto3Model):
"""
Port mappings allow containers to access ports on the host container instance to
send or receive traffic. Port mappings are specified as part of the container
definition.
If you use containers in a task with the ``awsvpc`` or ``host`` network mode, specify the exposed ports using
``containerPort``. The ``hostPort`` can be left blank or it must be the same value as the ``containerPort``.
Most fields of this parameter (``containerPort``, ``hostPort``, ``protocol``) maps to ``PortBindings`` in the docker
container create command and the ``--publish`` option to ``docker run``. If the network mode of a task definition is set
to ``host``, host ports must either be undefined or match the container port in the port mapping.
You can't expose the same container port for multiple protocols. If you attempt this, an error is returned.
After a task reaches the ``RUNNING`` status, manual and automatic host and container port assignments are visible in the
``networkBindings`` section of
`DescribeTasks <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeTasks.html>`_ API responses.
"""
containerPort: "int | None" = None
"""
The port number on the container that's bound to the user-specified or automatically
assigned host port.
"""
hostPort: "int | None" = None
"""
The port number on the container instance to reserve for your container.
"""
protocol: "Literal['tcp', 'udp'] | None" = None
"""
The protocol used for the port mapping.
Valid values are ``tcp`` and ``udp``. The default is ``tcp``. ``protocol`` is
immutable in a Service Connect service. Updating this field requires a service deletion and redeployment.
"""
name: "str | None" = None
"""
The name that's used for the port mapping.
This parameter is the name that you use in the
``serviceConnectConfiguration`` and the ``vpcLatticeConfigurations`` of a service. The name can include up to 64
characters. The characters can include lowercase letters, numbers, underscores (_), and hyphens (-). The name can't
start with a hyphen.
"""
appProtocol: "Literal['http', 'http2', 'grpc'] | None" = None
"""
The application protocol that's used for the port mapping.
This parameter only applies to Service Connect. We recommend that you set this
parameter to be consistent with the protocol that your application uses. If you set
this parameter, Amazon ECS adds protocol-specific connection handling to the Service
Connect proxy. If you set this parameter, Amazon ECS adds protocol-specific
telemetry in the Amazon ECS console and CloudWatch.
"""
containerPortRange: "str | None" = None
"""
The port number range on the container that's bound to the dynamically mapped host
port range.
"""
[docs]class ContainerRestartPolicy(Boto3Model):
"""
You can enable a restart policy for each container defined in your task definition,
to overcome transient failures faster and maintain task availability.
When you enable a restart policy for a container, Amazon ECS can restart the
container if it exits, without needing to replace the task. For more information,
see
`Restart individual containers in Amazon ECS tasks with container restart policies <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-
restart-policy.html>`_ in the *Amazon Elastic Container Service Developer Guide*.
"""
enabled: bool
"""
Specifies whether a restart policy is enabled for the container.
"""
ignoredExitCodes: "builtins.list[int] | None" = Field(default_factory=list)
"""
A list of exit codes that Amazon ECS will ignore and not attempt a restart on.
You can specify a maximum of 50 container exit codes. By default, Amazon ECS does
not ignore any exit codes.
"""
restartAttemptPeriod: "int | None" = None
"""
A period of time (in seconds) that the container must run for before a restart can
be attempted.
A container can be
restarted only once every ``restartAttemptPeriod`` seconds. If a container isn't able to run for this time period and
exits early, it will not be restarted. You can set a minimum ``restartAttemptPeriod`` of 60 seconds and a maximum
``restartAttemptPeriod`` of 1800 seconds. By default, a container must run for 300 seconds before it can be restarted.
"""
[docs]class EnvironmentFile(Boto3Model):
"""
A list of files containing the environment variables to pass to a container. You can
specify up to ten environment files. The file must have a ``.env`` file extension.
Each line in an environment file should contain an environment variable in
``VARIABLE=VALUE`` format. Lines beginning with ``#`` are treated as comments and
are ignored.
If there are environment variables specified using the ``environment`` parameter in a container definition, they take
precedence over the variables contained within an environment file. If multiple environment files are specified that
contain the same variable, they're processed from the top down. We recommend that you use unique variable names. For
more information, see `Use a file to pass environment variables to a
container <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/use-environment-file.html>`_ in the *Amazon Elastic
Container Service Developer Guide*.
Environment variable files are objects in Amazon S3 and all Amazon S3 security considerations apply.
You must use the following platforms for the Fargate launch type:
* Linux platform version ``1.4.0`` or later.
* Windows platform version ``1.0.0`` or later.
Consider the following when using the Fargate launch type:
* The file is handled like a native Docker env-file.
* There is no support for shell escape handling.
* The container entry point interperts the ``VARIABLE`` values.
"""
value: str
"""
The Amazon Resource Name (ARN) of the Amazon S3 object containing the environment
variable file.
"""
type: Literal["s3"]
"""
The file type to use.
Environment files are objects in Amazon S3. The only supported value is ``s3``.
"""
[docs]class MountPoint(Boto3Model):
"""
The details for a volume mount point that's used in a container definition.
"""
sourceVolume: "str | None" = None
"""
The name of the volume to mount.
Must be a volume name referenced in the ``name`` parameter of task definition
``volume``.
"""
containerPath: "str | None" = None
"""
The path on the container to mount the host volume at.
"""
readOnly: "bool | None" = None
"""
If this value is ``true``, the container has read-only access to the volume.
If this value is ``false``, then the
container can write to the volume. The default value is ``false``.
"""
[docs]class VolumeFrom(Boto3Model):
"""
Details on a data volume from another container in the same task definition.
"""
sourceContainer: "str | None" = None
"""
The name of another container within the same task definition to mount volumes from.
"""
readOnly: "bool | None" = None
"""
If this value is ``true``, the container has read-only access to the volume.
If this value is ``false``, then the
container can write to the volume. The default value is ``false``.
"""
[docs]class KernelCapabilities(Boto3Model):
"""The Linux capabilities to add or remove from the default Docker configuration for a container defined in the task
definition. For more detailed information about these Linux capabilities, see the
`capabilities(7) <http://man7.org/linux/man-pages/man7/capabilities.7.html>`_ Linux manual page.
The following describes how Docker processes the Linux capabilities specified in the ``add`` and ``drop`` request
parameters. For information about the latest behavior, see `Docker Compose: order of cap_drop and
cap_add <https://forums.docker.com/t/docker-compose-order-of-cap-drop-and-cap-add/97136/1>`_ in the Docker Community
Forum.
* When the container is a privleged container, the container capabilities are all of the default Docker capabilities.
The capabilities specified in the ``add`` request parameter, and the ``drop`` request parameter are ignored.
* When the ``add`` request parameter is set to ALL, the container capabilities are all of the default Docker
capabilities, excluding those specified in the ``drop`` request parameter.
* When the ``drop`` request parameter is set to ALL, the container capabilities are the capabilities specified in the
``add`` request parameter.
* When the ``add`` request parameter and the ``drop`` request parameter are both empty, the capabilities the container
capabilities are all of the default Docker capabilities.
* The default is to first drop the capabilities specified in the ``drop`` request parameter, and then add the
capabilities specified in the ``add`` request parameter.
"""
add: "builtins.list[str] | None" = Field(default_factory=list)
"""
The Linux capabilities for the container that have been added to the default
configuration provided by Docker.
This
parameter maps to ``CapAdd`` in the docker container create command and the ``--cap-add`` option to docker run.
"""
drop: "builtins.list[str] | None" = Field(default_factory=list)
"""
The Linux capabilities for the container that have been removed from the default
configuration provided by Docker.
This
parameter maps to ``CapDrop`` in the docker container create command and the ``--cap-drop`` option to docker run.
"""
[docs]class Device(Boto3Model):
"""
An object representing a container instance host device.
"""
hostPath: str
"""
The path for the device on the host container instance.
"""
containerPath: "str | None" = None
"""
The path inside the container at which to expose the host device.
"""
permissions: "builtins.list[Literal['read', 'write', 'mknod']] | None" = Field(
default_factory=list
)
"""
The explicit permissions to provide to the container for the device.
By default, the container has permissions for
``read``, ``write``, and ``mknod`` for the device.
"""
[docs]class Tmpfs(Boto3Model):
"""
The container path, mount options, and size of the tmpfs mount.
"""
containerPath: str
"""
The absolute file path where the tmpfs volume is to be mounted.
"""
size: int
"""
The maximum size (in MiB) of the tmpfs volume.
"""
mountOptions: "builtins.list[str] | None" = Field(default_factory=list)
"""
The list of tmpfs volume mount options.
"""
[docs]class LinuxParameters(Boto3Model):
"""The Linux-specific options that are applied to the container, such as Linux
`KernelCapabilities <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_KernelCapabilities.html>`_.
"""
capabilities: "KernelCapabilities | None" = None
"""
The Linux capabilities for the container that are added to or dropped from the
default configuration provided by Docker.
"""
devices: "builtins.list[Device] | None" = Field(default_factory=list)
"""
Any host devices to expose to the container.
This parameter maps to ``Devices`` in the docker container create command
and the ``--device`` option to docker run.
"""
initProcessEnabled: "bool | None" = None
"""
Run an ``init`` process inside the container that forwards signals and reaps
processes.
This parameter maps to the
``--init`` option to docker run. This parameter requires version 1.25 of the Docker Remote API or greater on your
container instance. To check the Docker Remote API version on your container instance, log in to your container instance
and run the following command: ``sudo docker version --format '{{.Server.APIVersion}}'``
"""
sharedMemorySize: "int | None" = None
"""
The value for the size (in MiB) of the ``/dev/shm`` volume.
This parameter maps to the ``--shm-size`` option to docker
run.
"""
tmpfs: "builtins.list[Tmpfs] | None" = Field(default_factory=list)
"""
The container path, mount options, and size (in MiB) of the tmpfs mount.
This parameter maps to the ``--tmpfs`` option
to docker run.
"""
maxSwap: "int | None" = None
"""
The total amount of swap memory (in MiB) a container can use.
This parameter will be translated to the ``--memory-swap``
option to docker run where the value would be the sum of the container memory plus the ``maxSwap`` value.
"""
swappiness: "int | None" = None
"""
This allows you to tune a container's memory swappiness behavior.
A ``swappiness`` value of ``0`` will cause swapping to
not happen unless absolutely necessary. A ``swappiness`` value of ``100`` will cause pages to be swapped very
aggressively. Accepted values are whole numbers between ``0`` and ``100``. If the ``swappiness`` parameter is not
specified, a default value of ``60`` is used. If a value is not specified for ``maxSwap`` then this parameter is
ignored. This parameter maps to the ``--memory-swappiness`` option to docker run.
"""
[docs]class ContainerDependency(Boto3Model):
"""
The dependencies defined for container startup and shutdown. A container can contain
multiple dependencies. When a dependency is defined for container startup, for
container shutdown it is reversed.
Your Amazon ECS container instances require at least version 1.26.0 of the container agent to use container
dependencies. However, we recommend using the latest container agent version. For information about checking your agent
version and updating to the latest version, see `Updating the Amazon ECS Container
Agent <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-update.html>`_ in the *Amazon Elastic
Container Service Developer Guide*. If you're using an Amazon ECS-optimized Linux AMI, your instance needs at least
version 1.26.0-1 of the ``ecs-init`` package. If your container instances are launched from version ``20190301`` or
later, then they contain the required versions of the container agent and ``ecs-init``. For more information, see
`Amazon ECS-optimized Linux AMI <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html>`_ in
the *Amazon Elastic Container Service Developer Guide*.
For tasks that use the Fargate launch type, the task or service requires the following platforms:
* Linux platform version ``1.3.0`` or later.
* Windows platform version ``1.0.0`` or later.
For more information about how to create a container dependency, see `Container dependency <https://docs.aws.amazon.com/
AmazonECS/latest/developerguide/example_task_definitions.html#example_task_definition-containerdependency>`_ in the
*Amazon Elastic Container Service Developer Guide*.
"""
containerName: str
"""
The name of a container.
"""
condition: Literal["START", "COMPLETE", "SUCCESS", "HEALTHY"]
"""
The dependency condition of the container.
The following are the available conditions and their behavior:
"""
[docs]class HostEntry(Boto3Model):
"""Hostnames and IP address entries that are added to the ``/etc/hosts`` file of a container via the ``extraHosts``
parameter of its
`ContainerDefinition <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html>`_.
"""
hostname: str
"""
The hostname to use in the ``/etc/hosts`` entry.
"""
ipAddress: str
"""
The IP address to use in the ``/etc/hosts`` entry.
"""
[docs]class Ulimit(Boto3Model):
"""
The ``ulimit`` settings to pass to the container.
Amazon ECS tasks hosted on Fargate use the default resource limit values set by the operating system with the exception
of the ``nofile`` resource limit parameter which Fargate overrides. The ``nofile`` resource limit sets a restriction on
the number of open files that a container can use. The default ``nofile`` soft limit is ``65535`` and the default hard
limit is ``65535``.
You can specify the ``ulimit`` settings for a container in a task definition.
"""
name: Literal[
"core",
"cpu",
"data",
"fsize",
"locks",
"memlock",
"msgqueue",
"nice",
"nofile",
"nproc",
"rss",
"rtprio",
"rttime",
"sigpending",
"stack",
]
"""
The ``type`` of the ``ulimit``.
"""
softLimit: int
"""
The soft limit for the ``ulimit`` type.
The value can be specified in bytes, seconds, or as a count, depending on the
``type`` of the ``ulimit``.
"""
hardLimit: int
"""
The hard limit for the ``ulimit`` type.
The value can be specified in bytes, seconds, or as a count, depending on the
``type`` of the ``ulimit``.
"""
[docs]class HealthCheck(Boto3Model):
"""
An object representing a container health check. Health check parameters that are
specified in a container definition override any Docker health checks that exist in
the container image (such as those specified in a parent image or from the image's
Dockerfile). This configuration maps to the ``HEALTHCHECK`` parameter of docker run.
The Amazon ECS container agent only monitors and reports on the health checks specified in the task definition. Amazon
ECS does not monitor Docker health checks that are embedded in a container image and not specified in the container
definition. Health check parameters that are specified in a container definition override any Docker health checks that
exist in the container image.
You can view the health status of both individual containers and a task with the DescribeTasks API operation or when
viewing the task details in the console.
The health check is designed to make sure that your containers survive agent restarts, upgrades, or temporary
unavailability.
Amazon ECS performs health checks on containers with the default that launched the container instance or the task.
The following describes the possible ``healthStatus`` values for a container:
* ``HEALTHY``-The container health check has passed successfully.
* ``UNHEALTHY``-The container health check has failed.
* ``UNKNOWN``-The container health check is being evaluated, there's no container health check defined, or Amazon ECS
doesn't have the health status of the container.
The following describes the possible ``healthStatus`` values based on the container health checker status of essential
containers in the task with the following priority order (high to low):
* ``UNHEALTHY``-One or more essential containers have failed their health check.
* ``UNKNOWN``-Any essential container running within the task is in an ``UNKNOWN`` state and no other essential
containers have an ``UNHEALTHY`` state.
* ``HEALTHY``-All essential containers within the task have passed their health checks.
Consider the following task health example with 2 containers.
* If Container1 is ``UNHEALTHY`` and Container2 is ``UNKNOWN``, the task health is ``UNHEALTHY``.
* If Container1 is ``UNHEALTHY`` and Container2 is ``HEALTHY``, the task health is ``UNHEALTHY``.
* If Container1 is ``HEALTHY`` and Container2 is ``UNKNOWN``, the task health is ``UNKNOWN``.
* If Container1 is ``HEALTHY`` and Container2 is ``HEALTHY``, the task health is ``HEALTHY``.
Consider the following task health example with 3 containers.
* If Container1 is ``UNHEALTHY`` and Container2 is ``UNKNOWN``, and Container3 is ``UNKNOWN``, the task health is
``UNHEALTHY``.
* If Container1 is ``UNHEALTHY`` and Container2 is ``UNKNOWN``, and Container3 is ``HEALTHY``, the task health is
``UNHEALTHY``.
* If Container1 is ``UNHEALTHY`` and Container2 is ``HEALTHY``, and Container3 is ``HEALTHY``, the task health is
``UNHEALTHY``.
* If Container1 is ``HEALTHY`` and Container2 is ``UNKNOWN``, and Container3 is ``HEALTHY``, the task health is
``UNKNOWN``.
* If Container1 is ``HEALTHY`` and Container2 is ``UNKNOWN``, and Container3 is ``UNKNOWN``, the task health is
``UNKNOWN``.
* If Container1 is ``HEALTHY`` and Container2 is ``HEALTHY``, and Container3 is ``HEALTHY``, the task health is
``HEALTHY``.
If a task is run manually, and not as part of a service, the task will continue its lifecycle regardless of its health
status. For tasks that are part of a service, if the task reports as unhealthy then the task will be stopped and the
service scheduler will replace it.
When a container health check fails for a task that is part of a service, the following process occurs:
1. The task is marked as ``UNHEALTHY``.
2. The unhealthy task will be stopped, and during the stopping process, it will go through the following states:
* ``DEACTIVATING`` - In this state, Amazon ECS performs additional steps before stopping the task. For example, for
tasks that are part of services configured to use Elastic Load Balancing target groups, target groups will be
deregistered in this state.
* ``STOPPING`` - The task is in the process of being stopped.
* ``DEPROVISIONING`` - Resources associated with the task are being cleaned up.
* ``STOPPED`` - The task has been completely stopped.
3. After the old task stops, a new task will be launched to ensure service operation, and the new task will go through
the following lifecycle:
* ``PROVISIONING`` - Resources required for the task are being provisioned.
* ``PENDING`` - The task is waiting to be placed on a container instance.
* ``ACTIVATING`` - In this state, Amazon ECS pulls container images, creates containers, configures task networking,
registers load balancer target groups, and configures service discovery status.
* ``RUNNING`` - The task is running and performing its work.
For more detailed information about task lifecycle states, see `Task
lifecycle <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-lifecycle-explanation.html>`_ in the *Amazon
Elastic Container Service Developer Guide*.
The following are notes about container health check support:
* If the Amazon ECS container agent becomes disconnected from the Amazon ECS service, this won't cause a container to
transition to an ``UNHEALTHY`` status. This is by design, to ensure that containers remain running during agent restarts
or temporary unavailability. The health check status is the "last heard from" response from the Amazon ECS agent, so if
the container was considered ``HEALTHY`` prior to the disconnect, that status will remain until the agent reconnects and
another health check occurs. There are no assumptions made about the status of the container health checks.
* Container health checks require version ``1.17.0`` or greater of the Amazon ECS container agent. For more information,
see `Updating the Amazon ECS container agent <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-
update.html>`_.
* Container health checks are supported for Fargate tasks if you're using platform version ``1.1.0`` or greater. For
more information, see `Fargate platform
versions <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html>`_.
* Container health checks aren't supported for tasks that are part of a service that's configured to use a Classic Load
Balancer.
For an example of how to specify a task definition with multiple containers where container dependency is specified, see
`Container dependency <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/example_task_definitions.html#example
_task_definition-containerdependency>`_ in the *Amazon Elastic Container Service Developer Guide*.
"""
command: "builtins.list[str]"
"""
A string array representing the command that the container runs to determine if it
is healthy.
The string array must
start with ``CMD`` to run the command arguments directly, or ``CMD-SHELL`` to run the command with the container's
default shell.
"""
interval: "int | None" = None
"""
The time period in seconds between each health check execution.
You may specify between 5 and 300 seconds. The default
value is 30 seconds. This value applies only when you specify a ``command``.
"""
timeout: "int | None" = None
"""
The time period in seconds to wait for a health check to succeed before it is
considered a failure.
You may specify
between 2 and 60 seconds. The default value is 5. This value applies only when you specify a ``command``.
"""
retries: "int | None" = None
"""
The number of times to retry a failed health check before the container is
considered unhealthy.
You may specify between
1 and 10 retries. The default value is 3. This value applies only when you specify a ``command``.
"""
startPeriod: "int | None" = None
"""
The optional grace period to provide containers time to bootstrap before failed
health checks count towards the maximum number of retries.
You can specify between 0 and 300 seconds. By default, the ``startPeriod`` is off. This value applies
only when you specify a ``command``.
"""
[docs]class SystemControl(Boto3Model):
"""
A list of namespaced kernel parameters to set in the container. This parameter maps
to ``Sysctls`` in the docker container create command and the ``--sysctl`` option to
docker run. For example, you can configure ``net.ipv4.tcp_keepalive_time`` setting
to maintain longer lived connections.
We don't recommend that you specify network-related ``systemControls`` parameters for multiple containers in a single
task that also uses either the ``awsvpc`` or ``host`` network mode. Doing this has the following disadvantages:
* For tasks that use the ``awsvpc`` network mode including Fargate, if you set ``systemControls`` for any container, it
applies to all containers in the task. If you set different ``systemControls`` for multiple containers in a single task,
the container that's started last determines which ``systemControls`` take effect.
* For tasks that use the ``host`` network mode, the network namespace ``systemControls`` aren't supported.
If you're setting an IPC resource namespace to use for the containers in the task, the following conditions apply to
your system controls. For more information, see `IPC mode <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/t
ask_definition_parameters.html#task_definition_ipcmode>`_.
* For tasks that use the ``host`` IPC mode, IPC namespace ``systemControls`` aren't supported.
* For tasks that use the ``task`` IPC mode, IPC namespace ``systemControls`` values apply to all containers within a
task.
This parameter is not supported for Windows containers.
This parameter is only supported for tasks that are hosted on Fargate if the tasks are using platform version ``1.4.0``
or later (Linux). This isn't supported for Windows containers on Fargate.
"""
namespace: "str | None" = None
"""
The namespaced kernel parameter to set a ``value`` for.
"""
value: "str | None" = None
"""
The namespaced kernel parameter to set a ``value`` for.
"""
[docs]class ResourceRequirement(Boto3Model):
"""
The type and amount of a resource to assign to a container.
The supported resource types are GPUs and Elastic Inference accelerators. For more
information, see
`Working with GPUs on Amazon ECS <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-gpu.html>`_
or
`Working with Amazon Elastic Inference on Amazon ECS <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-inference.html>`_
in the *Amazon Elastic
Container Service Developer Guide*
"""
value: str
"""
The value for the specified resource type.
"""
type: Literal["GPU", "InferenceAccelerator"]
"""
The type of resource to assign to a container.
"""
[docs]class FirelensConfiguration(Boto3Model):
"""
The FireLens configuration for the container.
This is used to specify and configure a log router for container logs. For more
information, see
`Custom log routing <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html>`_
in the *Amazon Elastic
Container Service Developer Guide*.
"""
type: Literal["fluentd", "fluentbit"]
"""
The log router to use.
The valid values are ``fluentd`` or ``fluentbit``.
"""
options: "dict[str, str] | None" = Field(default_factory=dict)
"""
The options to use when configuring the log router.
This field is optional and can be used to specify a custom
configuration file or to add additional metadata, such as the task, task definition, cluster, and container instance
details to the log event. If specified, the syntax to use is ``"options":{"enable-ecs-log-
metadata":"true|false","config-file-type:"s3|file","config-file-value":"arn:aws:s3:::mybucket/fluent.conf|filepath"}``.
For more information, see `Creating a task definition that uses a FireLens
configuration <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html#firelens-taskdef>`_ in the
*Amazon Elastic Container Service Developer Guide*.
"""
[docs]class ContainerDefinition(Boto3Model):
"""
Container definitions are used in task definitions to describe the different
containers that are launched as part of a task.
"""
name: str
"""
The name of a container.
If you're linking multiple containers together in a task definition, the ``name`` of one
container can be entered in the ``links`` of another container to connect the containers. Up to 255 letters (uppercase
and lowercase), numbers, underscores, and hyphens are allowed. This parameter maps to ``name`` in the docker container
create command and the ``--name`` option to docker run.
"""
image: str
"""
The image used to start a container. This string is passed directly to the Docker
daemon. By default, images in the Docker Hub registry are available. Other
repositories are specified with either ``repository-url/image:tag`` or
``repository-url/image@digest`` . For images using tags (repository-url/image:tag),
up to 255 characters total are allowed, including letters (uppercase and lowercase),
numbers, hyphens, underscores, colons, periods, forward slashes,
and number signs (#). For images using digests (repository-url/image@digest), the 255 character limit applies only to
the repository URL and image name (everything before the @ sign). The only supported hash function is sha256, and the
hash value after sha256: must be exactly 64 characters (only letters A-F, a-f, and numbers 0-9 are allowed). This
parameter maps to ``Image`` in the docker container create command and the ``IMAGE`` parameter of docker run.
"""
essential: bool
"""
If the ``essential`` parameter of a container is marked as ``true``, and that
container fails or stops for any reason, all other containers that are part of the
task are stopped.
If the ``essential`` parameter of a container is marked as
``false``, its failure doesn't affect the rest of the containers in a task. If this parameter is omitted, a container is
assumed to be essential.
"""
secrets: "builtins.list[ECSContainerDefinitionSecret] | None" = Field(
default_factory=list
)
"""
The secrets to pass to the container.
For more information, see
`Specifying Sensitive Data <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html>`_
in the *Amazon Elastic
Container Service Developer Guide*.
"""
repositoryCredentials: "RepositoryCredentials | None" = None
"""
The private repository authentication credentials to use.
"""
cpu: "int | None" = None
"""
The number of ``cpu`` units reserved for the container.
This parameter maps to ``CpuShares`` in the docker container
create command and the ``--cpu-shares`` option to docker run.
"""
memory: "int | None" = None
"""
The amount (in MiB) of memory to present to the container.
If your container attempts to exceed the memory specified
here, the container is killed. The total amount of memory reserved for all containers within a task must be lower than
the task ``memory`` value, if one is specified. This parameter maps to ``Memory`` in the docker container create command
and the ``--memory`` option to docker run.
"""
memoryReservation: "int | None" = None
"""
The soft limit (in MiB) of memory to reserve for the container.
When system memory is under heavy contention, Docker
attempts to keep the container memory to this soft limit. However, your container can consume more memory when it needs
to, up to either the hard limit specified with the ``memory`` parameter (if applicable), or all of the available memory
on the container instance, whichever comes first. This parameter maps to ``MemoryReservation`` in the docker container
create command and the ``--memory-reservation`` option to docker run.
"""
links: "builtins.list[str] | None" = Field(default_factory=list)
"""
The ``links`` parameter allows containers to communicate with each other without the
need for port mappings.
This
parameter is only supported if the network mode of a task definition is ``bridge``. The ``name:internalName`` construct
is analogous to ``name:alias`` in Docker links. Up to 255 letters (uppercase and lowercase), numbers, underscores, and
hyphens are allowed.. This parameter maps to ``Links`` in the docker container create command and the ``--link`` option
to docker run.
"""
portMappings: "builtins.list[PortMapping] | None" = Field(default_factory=list)
"""
The list of port mappings for the container.
Port mappings allow containers to access ports on the host container instance to
send or receive traffic.
"""
restartPolicy: "ContainerRestartPolicy | None" = None
"""
The restart policy for a container.
When you set up a restart policy, Amazon ECS can restart the container without
needing to replace the task. For more information, see
`Restart individual containers in Amazon ECS tasks with container restart policies <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-restart-policy.html>`_
in the
*Amazon Elastic Container Service Developer Guide*.
"""
entryPoint: "builtins.list[str] | None" = Field(default_factory=list)
"""
Early versions of the Amazon ECS container agent don't properly handle
``entryPoint`` parameters.
If you have problems
using ``entryPoint``, update your container agent or enter your commands and arguments as ``command`` array items
instead.
"""
command: "builtins.list[str] | None" = Field(default_factory=list)
"""
The command that's passed to the container.
This parameter maps to ``Cmd`` in the docker container create command and
the ``COMMAND`` parameter to docker run. If there are multiple arguments, each argument is a separated string in the
array.
"""
environment: "builtins.list[KeyValuePair] | None" = Field(default_factory=list)
"""
The environment variables to pass to a container.
This parameter maps to ``Env`` in the docker container create command
and the ``--env`` option to docker run.
"""
environmentFiles: "builtins.list[EnvironmentFile] | None" = Field(
default_factory=list
)
"""
A list of files containing the environment variables to pass to a container.
This parameter maps to the ``--env-file``
option to docker run.
"""
mountPoints: "builtins.list[MountPoint] | None" = Field(default_factory=list)
"""
The mount points for data volumes in your container.
"""
volumesFrom: "builtins.list[VolumeFrom] | None" = Field(default_factory=list)
"""
Data volumes to mount from another container.
This parameter maps to ``VolumesFrom`` in the docker container create
command and the ``--volumes-from`` option to docker run.
"""
linuxParameters: "LinuxParameters | None" = None
"""
Linux-specific modifications that are applied to the default Docker container
configuration, such as Linux kernel capabilities.
For more information see
`KernelCapabilities <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_KernelCapabilities.html>`_.
"""
dependsOn: "builtins.list[ContainerDependency] | None" = Field(default_factory=list)
"""
The dependencies defined for container startup and shutdown.
A container can contain multiple dependencies on other containers in a task
definition. When a dependency is defined for container startup, for container
shutdown it is reversed.
"""
startTimeout: "int | None" = None
"""
Time duration (in seconds) to wait before giving up on resolving dependencies for a
container.
For example, you specify
two containers in a task definition with containerA having a dependency on containerB reaching a ``COMPLETE``,
``SUCCESS``, or ``HEALTHY`` status. If a ``startTimeout`` value is specified for containerB and it doesn't reach the
desired status within that time then containerA gives up and not start. This results in the task transitioning to a
``STOPPED`` state.
"""
stopTimeout: "int | None" = None
"""
Time duration (in seconds) to wait before the container is forcefully killed if it
doesn't exit normally on its own.
"""
versionConsistency: "Literal['enabled', 'disabled'] | None" = None
"""
Specifies whether Amazon ECS will resolve the container image tag provided in the
container definition to an image digest.
By default, the value is ``enabled``. If you set the value for a container as ``disabled``, Amazon ECS will not
resolve the provided container image tag to a digest and will use the original image URI specified in the container
definition for deployment. For more information about container image resolution, see `Container image
resolution <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-ecs.html#deployment-container-
image-stability>`_ in the *Amazon ECS Developer Guide*.
"""
hostname: "str | None" = None
"""
The hostname to use for your container.
This parameter maps to ``Hostname`` in the docker container create command and
the ``--hostname`` option to docker run.
"""
user: "str | None" = None
"""
The user to use inside the container.
This parameter maps to ``User`` in the docker container create command and the
``--user`` option to docker run.
"""
workingDirectory: "str | None" = None
"""
The working directory to run commands inside the container in.
This parameter maps to ``WorkingDir`` in the docker
container create command and the ``--workdir`` option to docker run.
"""
disableNetworking: "bool | None" = None
"""
When this parameter is true, networking is off within the container.
This parameter maps to ``NetworkDisabled`` in the
docker container create command.
"""
privileged: "bool | None" = None
"""
When this parameter is true, the container is given elevated privileges on the host
container instance (similar to the ``root`` user).
This parameter maps to ``Privileged`` in the docker container create command and the ``--privileged``
option to docker run
"""
readonlyRootFilesystem: "bool | None" = None
"""
When this parameter is true, the container is given read-only access to its root
file system.
This parameter maps to
``ReadonlyRootfs`` in the docker container create command and the ``--read-only`` option to docker run.
"""
dnsServers: "builtins.list[str] | None" = Field(default_factory=list)
"""
A list of DNS servers that are presented to the container.
This parameter maps to ``Dns`` in the docker container create
command and the ``--dns`` option to docker run.
"""
dnsSearchDomains: "builtins.list[str] | None" = Field(default_factory=list)
"""
A list of DNS search domains that are presented to the container.
This parameter maps to ``DnsSearch`` in the docker
container create command and the ``--dns-search`` option to docker run.
"""
extraHosts: "builtins.list[HostEntry] | None" = Field(default_factory=list)
"""
A list of hostnames and IP address mappings to append to the ``/etc/hosts`` file on
the container.
This parameter maps
to ``ExtraHosts`` in the docker container create command and the ``--add-host`` option to docker run.
"""
dockerSecurityOptions: "builtins.list[str] | None" = Field(default_factory=list)
"""
A list of strings to provide custom configuration for multiple security systems.
This field isn't valid for containers in tasks using the Fargate launch type.
"""
interactive: "bool | None" = None
"""
When this parameter is ``true``, you can deploy containerized applications that
require ``stdin`` or a ``tty`` to be allocated.
This parameter maps to ``OpenStdin`` in the docker container create command and the ``--interactive`` option
to docker run.
"""
pseudoTerminal: "bool | None" = None
"""
When this parameter is ``true``, a TTY is allocated.
This parameter maps to ``Tty`` in the docker container create
command and the ``--tty`` option to docker run.
"""
dockerLabels: "dict[str, str] | None" = Field(default_factory=dict)
"""
A key/value map of labels to add to the container.
This parameter maps to ``Labels`` in the docker container create
command and the ``--label`` option to docker run. This parameter requires version 1.18 of the Docker Remote API or
greater on your container instance. To check the Docker Remote API version on your container instance, log in to your
container instance and run the following command: ``sudo docker version --format '{{.Server.APIVersion}}'``
"""
ulimits: "builtins.list[Ulimit] | None" = Field(default_factory=list)
"""
A list of ``ulimits`` to set in the container.
If a ``ulimit`` value is specified in a task definition, it overrides the
default values set by Docker. This parameter maps to ``Ulimits`` in the docker container create command and the
``--ulimit`` option to docker run. Valid naming values are displayed in the
`Ulimit <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_Ulimit.html>`_ data type.
"""
logConfiguration: "LogConfiguration | None" = None
"""
The log configuration specification for the container.
"""
healthCheck: "HealthCheck | None" = None
"""
The container health check command and associated configuration parameters for the
container.
This parameter maps to
``HealthCheck`` in the docker container create command and the ``HEALTHCHECK`` parameter of docker run.
"""
systemControls: "builtins.list[SystemControl] | None" = Field(default_factory=list)
"""
A list of namespaced kernel parameters to set in the container.
This parameter maps to ``Sysctls`` in the docker
container create command and the ``--sysctl`` option to docker run. For example, you can configure
``net.ipv4.tcp_keepalive_time`` setting to maintain longer lived connections.
"""
resourceRequirements: "builtins.list[ResourceRequirement] | None" = Field(
default_factory=list
)
"""
The type and amount of a resource to assign to a container.
The only supported resource is a GPU.
"""
firelensConfiguration: "FirelensConfiguration | None" = None
"""
The FireLens configuration for the container.
This is used to specify and configure a log router for container logs. For more
information, see
`Custom Log Routing <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html>`_
in the *Amazon Elastic
Container Service Developer Guide*.
"""
credentialSpecs: "builtins.list[str] | None" = Field(default_factory=list)
"""
A list of ARNs in SSM or Amazon S3 to a credential spec (``CredSpec``) file that
configures the container for Active Directory authentication.
We recommend that you use this parameter instead of the ``dockerSecurityOptions``. The maximum
number of ARNs is 1.
"""
@property
def full_repository_uri(self) -> str | None:
"""
The full repository URI of the image that this container definition uses.
For example: ``123456789012.dkr.ecr.us-east-1.amazonaws.com/my-group/my-image``.
"""
return self.transform("image", r"^(.+):.+$")
@property
def repository_name(self) -> str | None:
"""
The name of the repository that houses the image that this container definition
uses.
For example: ``my-group/my-image``.
"""
return self.transform("image", r"^.+?/(.+):.+$")
@property
def image_tag(self) -> str | None:
"""
The tag of the image that this container definition uses.
For example: ``latest``.
"""
return self.transform("image", r"^.+:(.+)$")
@cached_property
def image_object(self) -> "ECRImage | None":
"""
Return the :class:`~botocraft.services.ecr.ECRImage` object that this container
definition uses.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"repositoryName": self.repository_name,
"imageId": ImageIdentifier(imageTag=self.image_tag),
}
)
except AttributeError:
return None
return ECRImage.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs]class HostVolumeProperties(Boto3Model):
"""
Details on a container instance bind mount host volume.
"""
sourcePath: "str | None" = None
"""
When the ``host`` parameter is used, specify a ``sourcePath`` to declare the path on
the host container instance that's presented to the container.
If this parameter is empty, then the Docker daemon has assigned a host path for you. If the
``host`` parameter contains a ``sourcePath`` file location, then the data volume persists at the specified location on
the host container instance until you delete it manually. If the ``sourcePath`` value doesn't exist on the host
container instance, the Docker daemon creates it. If the location does exist, the contents of the source path folder are
exported.
"""
[docs]class DockerVolumeConfiguration(Boto3Model):
"""
This parameter is specified when you're using Docker volumes.
Docker volumes are only supported when you're using the
EC2 launch type. Windows containers only support the use of the ``local`` driver. To use bind mounts, specify a ``host``
instead.
"""
scope: "Literal['task', 'shared'] | None" = None
"""
The scope for the Docker volume that determines its lifecycle.
Docker volumes that are scoped to a ``task`` are
automatically provisioned when the task starts and destroyed when the task stops. Docker volumes that are scoped as
``shared`` persist after the task stops.
"""
autoprovision: "bool | None" = None
"""
If this value is ``true``, the Docker volume is created if it doesn't already exist.
"""
driver: "str | None" = None
"""
The Docker volume driver to use.
The driver value must match the driver name provided by Docker because it is used for
task placement. If the driver was installed using the Docker plugin CLI, use ``docker plugin ls`` to retrieve the driver
name from your container instance. If the driver was installed using another method, use Docker plugin discovery to
retrieve the driver name. This parameter maps to ``Driver`` in the docker container create command and the ``xxdriver``
option to docker volume create.
"""
driverOpts: "dict[str, str] | None" = Field(default_factory=dict)
"""
A map of Docker driver-specific options passed through.
This parameter maps to ``DriverOpts`` in the docker create-
volume command and the ``xxopt`` option to docker volume create.
"""
labels: "dict[str, str] | None" = Field(default_factory=dict)
"""
Custom metadata to add to your Docker volume.
This parameter maps to ``Labels`` in the docker container create command
and the ``xxlabel`` option to docker volume create.
"""
[docs]class EFSAuthorizationConfig(Boto3Model):
"""
The authorization configuration details for the Amazon EFS file system.
"""
accessPointId: "str | None" = None
"""
The Amazon EFS access point ID to use.
If an access point is specified, the root directory value specified in the
``EFSVolumeConfiguration`` must either be omitted or set to ``/`` which will enforce the path set on the EFS access
point. If an access point is used, transit encryption must be on in the ``EFSVolumeConfiguration``. For more
information, see `Working with Amazon EFS access points <https://docs.aws.amazon.com/efs/latest/ug/efs-access-
points.html>`_ in the *Amazon Elastic File System User Guide*.
"""
iam: "Literal['ENABLED', 'DISABLED'] | None" = None
"""
Determines whether to use the Amazon ECS task role defined in a task definition when
mounting the Amazon EFS file system.
If it is turned on, transit encryption must be turned on in the ``EFSVolumeConfiguration``. If this parameter is
omitted, the default value of ``DISABLED`` is used. For more information, see `Using Amazon EFS access
points <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/efs-volumes.html#efs-volume-accesspoints>`_ in the
*Amazon Elastic Container Service Developer Guide*.
"""
[docs]class EFSVolumeConfiguration(Boto3Model):
"""
This parameter is specified when you're using an Amazon Elastic File System file
system for task storage.
For more information, see
`Amazon EFS volumes <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/efs-volumes.html>`_
in
the *Amazon Elastic Container Service Developer Guide*.
"""
fileSystemId: str
"""
The Amazon EFS file system ID to use.
"""
rootDirectory: "str | None" = None
"""
The directory within the Amazon EFS file system to mount as the root directory
inside the host.
If this parameter is
omitted, the root of the Amazon EFS volume will be used. Specifying ``/`` will have the same effect as omitting this
parameter.
"""
transitEncryption: "Literal['ENABLED', 'DISABLED'] | None" = None
"""
Determines whether to use encryption for Amazon EFS data in transit between the
Amazon ECS host and the Amazon EFS server.
Transit encryption must be turned on if Amazon EFS IAM authorization is used. If this parameter is omitted, the
default value of ``DISABLED`` is used. For more information, see `Encrypting data in
transit <https://docs.aws.amazon.com/efs/latest/ug/encryption-in-transit.html>`_ in the *Amazon Elastic File System User
Guide*.
"""
transitEncryptionPort: "int | None" = None
"""
The port to use when sending encrypted data between the Amazon ECS host and the
Amazon EFS server.
If you do not specify a transit encryption port, it will use the port selection
strategy that the Amazon EFS mount helper uses. For more information, see
`EFS mount helper <https://docs.aws.amazon.com/efs/latest/ug/efs-mount-helper.html>`_
in the *Amazon
Elastic File System User Guide*.
"""
authorizationConfig: "EFSAuthorizationConfig | None" = None
"""
The authorization configuration details for the Amazon EFS file system.
"""
[docs]class S3FilesVolumeConfiguration(Boto3Model):
"""This parameter is specified when you're using an Amazon S3 Files file system for task storage. For more information, see
`Amazon S3 Files volumes <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/s3files-volumes.html>`_ in the
*Amazon Elastic Container Service Developer Guide*.
Your task definition must include a Task IAM Role. See `IAM role for attaching your file system to AWS compute
resources <https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-files-prereq-policies.html#s3-files-prereq-iam-
compute-role>`_ for required permissions.
"""
fileSystemArn: str
"""
The full ARN of the S3 Files file system to mount.
"""
rootDirectory: "str | None" = None
"""
The directory within the Amazon S3 Files file system to mount as the root directory.
If this parameter is omitted, the
root of the Amazon S3 Files file system will be used. Specifying ``/`` will have the same effect as omitting this
parameter.
"""
transitEncryptionPort: "int | None" = None
"""
The port to use for sending encrypted data between the ECS host and the S3 Files
file system.
If you do not specify a transit encryption port, it will use the port selection
strategy that the Amazon S3 Files mount helper uses. For more information, see
`S3 Files mount helper <https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-files-mounting.html>`_.
"""
accessPointArn: "str | None" = None
"""
The full ARN of the S3 Files access point to use.
If an access point is specified, the root directory value specified in
the ``S3FilesVolumeConfiguration`` must either be omitted or set to ``/`` which will enforce the path set on the S3
Files access point. For more information, see `Creating S3 Files access
points <https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-files-access-points-creating.html>`_.
"""
[docs]class FSxWindowsFileServerAuthorizationConfig(Boto3Model):
"""The authorization configuration details for Amazon FSx for Windows File Server file system. See `FSxWindowsFileServerVol
umeConfiguration <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_FSxWindowsFileServerVolumeConfiguration.
html>`_ in the *Amazon ECS API Reference*.
For more information and the input format, see `Amazon FSx for Windows File Server
Volumes <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/wfsx-volumes.html>`_ in the *Amazon Elastic Container
Service Developer Guide*.
"""
credentialsParameter: str
"""
The authorization credential option to use.
The authorization credential options can be provided using either the Amazon
Resource Name (ARN) of an Secrets Manager secret or SSM Parameter Store parameter.
The ARN refers to the stored credentials.
"""
domain: str
"""
A fully qualified domain name hosted by an `Directory
Service <https://docs.aws.amazon.com/directoryservice/latest/admin-guide/directory_microsoft_ad.html>`_ Managed Microsoft
AD (Active Directory) or self-hosted AD on Amazon EC2.
"""
[docs]class FSxWindowsFileServerVolumeConfiguration(Boto3Model):
"""This parameter is specified when you're using `Amazon FSx for Windows File
Server <https://docs.aws.amazon.com/fsx/latest/WindowsGuide/what-is.html>`_ file system for task storage.
For more information and the input format, see `Amazon FSx for Windows File Server
volumes <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/wfsx-volumes.html>`_ in the *Amazon Elastic Container
Service Developer Guide*.
"""
fileSystemId: str
"""
The Amazon FSx for Windows File Server file system ID to use.
"""
rootDirectory: str
"""
The directory within the Amazon FSx for Windows File Server file system to mount as
the root directory inside the host.
"""
authorizationConfig: FSxWindowsFileServerAuthorizationConfig
"""
The authorization configuration details for the Amazon FSx for Windows File Server
file system.
"""
[docs]class Volume(Boto3Model):
"""
The data volume configuration for tasks launched using this task definition.
Specifying a volume configuration in a task
definition is optional. The volume configuration may contain multiple volumes but only one volume configured at launch
is supported. Each volume defined in the volume configuration may only specify a ``name`` and one of either
``configuredAtLaunch``, ``dockerVolumeConfiguration``, ``efsVolumeConfiguration``, ``s3filesVolumeConfiguration``,
``fsxWindowsFileServerVolumeConfiguration``, or ``host``. If an empty volume configuration is specified, by default
Amazon ECS uses a host volume. For more information, see `Using data volumes in
tasks <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_data_volumes.html>`_.
"""
name: "str | None" = None
"""
The name of the volume.
Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are
allowed.
"""
host: "HostVolumeProperties | None" = None
"""
This parameter is specified when you use bind mount host volumes.
The contents of the ``host`` parameter determine
whether your bind mount host volume persists on the host container instance and where it's stored. If the ``host``
parameter is empty, then the Docker daemon assigns a host path for your data volume. However, the data isn't guaranteed
to persist after the containers that are associated with it stop running.
"""
dockerVolumeConfiguration: "DockerVolumeConfiguration | None" = None
"""
This parameter is specified when you use Docker volumes.
"""
efsVolumeConfiguration: "EFSVolumeConfiguration | None" = None
"""
This parameter is specified when you use an Amazon Elastic File System file system
for task storage.
"""
s3filesVolumeConfiguration: "S3FilesVolumeConfiguration | None" = None
"""
This parameter is specified when you use an Amazon S3 Files file system for task
storage.
"""
fsxWindowsFileServerVolumeConfiguration: "FSxWindowsFileServerVolumeConfiguration | None" = None
"""
This parameter is specified when you use Amazon FSx for Windows File Server file
system for task storage.
"""
configuredAtLaunch: "bool | None" = None
"""
Indicates whether the volume should be configured at launch time.
This is used to create Amazon EBS volumes for standalone tasks or tasks created as
part of a service. Each task definition revision may only have one volume configured
at launch in the volume configuration.
"""
[docs]class Attribute(Boto3Model):
"""
An attribute is a name-value pair that's associated with an Amazon ECS object.
Use attributes to extend the Amazon ECS data model by adding custom metadata to your
resources. For more information, see
`Attributes <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html#attributes>`_
in
the *Amazon Elastic Container Service Developer Guide*.
"""
name: str
"""
The name of the attribute.
The ``name`` must contain between 1 and 128 characters. The name may contain letters
(uppercase and lowercase), numbers, hyphens (-), underscores (_), forward slashes (/), back slashes (), or periods
(.).
"""
value: "str | None" = None
"""
The value of the attribute.
The ``value`` must contain between 1 and 128 characters. It can contain letters (uppercase
and lowercase), numbers, hyphens (-), underscores (_), periods (.), at signs (@), forward slashes (/), back slashes
(), colons (:), or spaces. The value can't start or end with a space.
"""
targetType: "Literal['container-instance'] | None" = None
"""
The type of the target to attach the attribute with.
This parameter is required if you use the short form ID for a resource instead of
the full ARN.
"""
targetId: "str | None" = None
"""
The ID of the target.
You can specify the short form ID for a resource or the full Amazon Resource Name
(ARN).
"""
[docs]class TaskDefinitionPlacementConstraint(Boto3Model):
"""The constraint on task placement in the task definition. For more information, see `Task placement
constraints <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html>`_ in the *Amazon
Elastic Container Service Developer Guide*.
Task placement constraints aren't supported for tasks run on Fargate.
"""
type: "Literal['memberOf'] | None" = None
"""
The type of constraint.
The ``MemberOf`` constraint restricts selection to be from a group of valid candidates.
"""
expression: "str | None" = None
"""
A cluster query language expression to apply to the constraint.
For more information, see
`Cluster query language <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query-language.html>`_
in the *Amazon
Elastic Container Service Developer Guide*.
"""
[docs]class InferenceAccelerator(Boto3Model):
"""
Details on an Elastic Inference accelerator.
For more information, see
`Working with Amazon Elastic Inference on Amazon ECS <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-inference.html>`_
in the *Amazon Elastic Container
Service Developer Guide*.
"""
deviceName: str
"""
The Elastic Inference accelerator device name.
The ``deviceName`` must also be referenced in a container definition as a
`ResourceRequirement <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ResourceRequirement.html>`_.
"""
deviceType: str
"""
The Elastic Inference accelerator type to use.
"""
[docs]class ECSProxyConfiguration(Boto3Model):
"""
The configuration details for the App Mesh proxy.
For tasks that use the EC2 launch type, the container instances require at least version 1.26.0 of the container agent
and at least version 1.26.0-1 of the ``ecs-init`` package to use a proxy configuration. If your container instances are
launched from the Amazon ECS optimized AMI version ``20190301`` or later, then they contain the required versions of the
container agent and ``ecs-init``. For more information, see `Amazon ECS-optimized Linux
AMI <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html>`_
"""
type: "Literal['APPMESH'] | None" = None
"""
The proxy type.
The only supported value is ``APPMESH``.
"""
containerName: str
"""
The name of the container that will serve as the App Mesh proxy.
"""
properties: "builtins.list[KeyValuePair] | None" = Field(default_factory=list)
"""
The set of network configuration parameters to provide the Container Network
Interface (CNI) plugin, specified as key- value pairs.
"""
[docs]class EphemeralStorage(Boto3Model):
"""The amount of ephemeral storage to allocate for the task. This parameter is used to expand the total amount of ephemeral
storage available, beyond the default amount, for tasks hosted on Fargate. For more information, see `Using data volumes
in tasks <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_data_volumes.html>`_ in the *Amazon ECS
Developer Guide;*.
For tasks using the Fargate launch type, the task requires the following platforms:
* Linux platform version ``1.4.0`` or later.
* Windows platform version ``1.0.0`` or later.
"""
sizeInGiB: int
"""
The total amount, in GiB, of ephemeral storage to set for the task.
The minimum supported value is ``21`` GiB and the
maximum supported value is ``200`` GiB.
"""
[docs]class TaskDefinition(TagsDictMixin, TaskDefinitionModelMixin, PrimaryBoto3Model):
"""
The details of a task definition which describes the container and volume
definitions of an Amazon Elastic Container Service task.
You can specify which Docker images to use, the required resources, and other
configurations related to launching the task definition through an Amazon ECS
service or task.
"""
tag_class: ClassVar[type[Boto3Model]] = ECSTag
manager_class: ClassVar[type[Boto3ModelManager]] = TaskDefinitionManager
family: str
"""
The name of a family that this task definition is registered to.
Up to 255 characters are allowed. Letters (both uppercase and lowercase letters),
numbers, hyphens (-), and underscores (_) are allowed.
"""
containerDefinitions: "builtins.list[ContainerDefinition]"
"""
A list of container definitions in JSON format that describe the different
containers that make up your task.
For more information about container definition parameters and defaults, see
`Amazon ECS Task Definitions <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_defintions.html>`_
in the *Amazon Elastic
Container Service Developer Guide*.
"""
networkMode: "Literal['bridge', 'host', 'awsvpc', 'none'] | None" = "awsvpc"
"""
The Docker networking mode to use for the containers in the task.
The valid values are ``none``, ``bridge``, ``awsvpc``,
and ``host``. If no network mode is specified, the default is ``bridge``.
"""
taskDefinitionArn: str = Field(default=None, frozen=True)
"""
The full Amazon Resource Name (ARN) of the task definition.
"""
taskRoleArn: "str | None" = None
"""
The short name or full Amazon Resource Name (ARN) of the Identity and Access
Management role that grants containers in the task permission to call Amazon Web
Services APIs on your behalf.
For informationabout the required IAM roles for Amazon ECS, see
`IAM roles for Amazon ECS <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/security-ecs-iam-
role-overview.html>`_ in the *Amazon Elastic Container Service Developer Guide*.
"""
executionRoleArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the task execution role that grants the Amazon ECS
container agent permission to make Amazon Web Services API calls on your behalf.
For informationabout the required IAM roles for Amazon ECS, see
`IAM roles for Amazon ECS <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/security-ecs-iam-role-overview.html>`_
in the
*Amazon Elastic Container Service Developer Guide*.
"""
revision: int = Field(default=None, frozen=True)
"""
The revision of the task in a particular family.
The revision is a version number of a task definition in a family. When
you register a task definition for the first time, the revision is ``1``. Each time that you register a new revision of
a task definition in the same family, the revision value always increases by one. This is even if you deregistered
previous revisions in this family.
"""
volumes: "builtins.list[Volume] | None" = Field(default_factory=list)
"""
The list of data volume definitions for the task.
For more information, see
`Using data volumes in tasks <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_data_volumes.html>`_
in the *Amazon Elastic
Container Service Developer Guide*.
"""
status: Literal["ACTIVE", "INACTIVE", "DELETE_IN_PROGRESS"] = Field(
default=None, frozen=True
)
"""
The status of the task definition.
"""
requiresAttributes: "builtins.list[Attribute]" = Field(
default_factory=list, frozen=True
)
"""
The container instance attributes required by your task.
When an Amazon EC2 instance is registered to your cluster, the Amazon ECS container
agent assigns some standard attributes to the instance. You can apply custom
attributes. These are specified as key-value pairs using the Amazon ECS console or
the
`PutAttributes <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_PutAttributes.html>`_
API. These attributes are used when determining task placement for tasks hosted
on Amazon EC2 instances. For more information, see
`Attributes <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html#attributes>`_
in
the *Amazon Elastic Container Service Developer Guide*.
"""
placementConstraints: "builtins.list[TaskDefinitionPlacementConstraint] | None" = (
Field(default_factory=list)
)
"""
An array of placement constraint objects to use for tasks.
"""
compatibilities: "builtins.list[Literal['EC2', 'FARGATE', 'EXTERNAL', 'MANAGED_INSTANCES']]" = Field(
default_factory=list, frozen=True
)
"""
Amazon ECS validates the task definition parameters with those supported by the
launch type.
For more information, see
`Amazon ECS launch types <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html>`_
in the *Amazon
Elastic Container Service Developer Guide*.
"""
runtimePlatform: "RuntimePlatform | None" = None
"""
The operating system that your task definitions are running on.
A platform family is specified only for tasks using the Fargate launch type.
"""
requiresCompatibilities: "builtins.list[Literal['EC2', 'FARGATE', 'EXTERNAL', 'MANAGED_INSTANCES']] | None" = Field(
default_factory=list
)
"""
The task launch types the task definition was validated against.
The valid values are ``MANAGED_INSTANCES``, ``EC2``,
``FARGATE``, and ``EXTERNAL``. For more information, see `Amazon ECS launch
types <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html>`_ in the *Amazon Elastic Container
Service Developer Guide*.
"""
cpu: "str | None" = None
"""
The number of ``cpu`` units used by the task.
If you use the EC2 launch type, this field is optional. Any value can be
used. If you use the Fargate launch type, this field is required. You must use one of the following values. The value
that you choose determines your range of valid values for the ``memory`` parameter.
"""
memory: "str | None" = None
"""
The amount (in MiB) of memory used by the task.
"""
inferenceAccelerators: "builtins.list[InferenceAccelerator] | None" = Field(
default_factory=list
)
"""
The Elastic Inference accelerator that's associated with the task.
"""
pidMode: "Literal['host', 'task'] | None" = None
"""
The process namespace to use for the containers in the task.
The valid values are ``host`` or ``task``. On Fargate for
Linux containers, the only valid value is ``task``. For example, monitoring sidecars might need ``pidMode`` to access
information about other containers running in the same task.
"""
ipcMode: "Literal['host', 'task', 'none'] | None" = None
"""
The IPC resource namespace to use for the containers in the task.
The valid values are ``host``, ``task``, or ``none``.
If ``host`` is specified, then all containers within the tasks that specified the ``host`` IPC mode on the same
container instance share the same IPC resources with the host Amazon EC2 instance. If ``task`` is specified, all
containers within the specified task share the same IPC resources. If ``none`` is specified, then IPC resources within
the containers of a task are private and not shared with other containers in a task or on the container instance. If no
value is specified, then the IPC resource namespace sharing depends on the Docker daemon setting on the container
instance.
"""
proxyConfiguration: "ECSProxyConfiguration | None" = None
"""
The configuration details for the App Mesh proxy.
"""
registeredAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the task definition was registered.
"""
deregisteredAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the task definition was deregistered.
"""
deleteRequestedAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the task definition delete was requested.
"""
registeredBy: str = Field(default=None, frozen=True)
"""
The principal that registered the task definition.
"""
ephemeralStorage: "EphemeralStorage | None" = None
"""
The ephemeral storage settings to use for tasks run with the task definition.
"""
enableFaultInjection: "bool | None" = None
"""
Enables fault injection and allows for fault injection requests to be accepted from
the task's containers.
The default
value is ``false``.
"""
Tags: "builtins.list[ECSTag] | None" = Field(default_factory=list)
"""
The tags for the task definition.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`taskDefinitionArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.taskDefinitionArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the
:py:attr:`taskDefinitionArn` attribute.
Returns:
The ARN of the model instance.
"""
return self.taskDefinitionArn
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`taskDefinitionArn` attribute.
"""
return hash(self.taskDefinitionArn)
[docs] def deregister(self) -> "TaskDefinition":
"""
Deregisters the specified task definition by family and revision.
Upon deregistration, the task definition is marked as
````INACTIVE````. Existing tasks and services that reference an ````INACTIVE```` task definition continue to run without
disruption. Existing services that reference an ````INACTIVE```` task definition can still scale up or down by modifying
the service's desired count. If you want to delete a task definition revision, you must first deregister the task
definition revision.
"""
return (
cast("TaskDefinitionManager", self.objects) # type: ignore[attr-defined]
.using(self.session)
.deregister(
self.taskDefinitionArn,
)
)
[docs]class NetworkBinding(Boto3Model):
"""
Details on the network bindings between a container and its host container instance.
After a task reaches the
``RUNNING`` status, manual and automatic host and container port assignments are visible in the ``networkBindings``
section of `DescribeTasks <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeTasks.html>`_ API
responses.
"""
bindIP: "str | None" = None
"""
The IP address that the container is bound to on the container instance.
"""
containerPort: "int | None" = None
"""
The port number on the container that's used with the network binding.
"""
hostPort: "int | None" = None
"""
The port number on the host that's used with the network binding.
"""
protocol: "Literal['tcp', 'udp'] | None" = None
"""
The protocol used for the network binding.
"""
containerPortRange: "str | None" = None
"""
The port number range on the container that's bound to the dynamically mapped host
port range.
"""
hostPortRange: "str | None" = None
"""
The port number range on the host that's used with the network binding.
This is assigned is assigned by Docker and delivered by the Amazon ECS agent.
"""
[docs]class ManagedAgent(Boto3Model):
"""
Details about the managed agent status for the container.
"""
lastStartedAt: "datetime | None" = None
"""
The Unix timestamp for the time when the managed agent was last started.
"""
name: "Literal['ExecuteCommandAgent'] | None" = None
"""
The name of the managed agent.
When the execute command feature is turned on, the managed agent name is
``ExecuteCommandAgent``.
"""
reason: "str | None" = None
"""
The reason for why the managed agent is in the state it is in.
"""
lastStatus: "str | None" = None
"""
The last known status of the managed agent.
"""
[docs]class Container(Boto3Model):
"""
A Docker container that's part of a task.
"""
containerArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the container.
"""
taskArn: "str | None" = None
"""
The ARN of the task.
"""
name: "str | None" = None
"""
The name of the container.
"""
image: "str | None" = None
"""
The image used for the container.
"""
imageDigest: "str | None" = None
"""
The container image manifest digest.
"""
runtimeId: "str | None" = None
"""
The ID of the Docker container.
"""
lastStatus: "str | None" = None
"""
The last known status of the container.
"""
exitCode: "int | None" = None
"""
The exit code returned from the container.
"""
reason: "str | None" = None
"""
A short (1024 max characters) human-readable string to provide additional details
about a running or stopped container.
"""
networkBindings: "builtins.list[NetworkBinding] | None" = Field(
default_factory=list
)
"""
The network bindings associated with the container.
"""
networkInterfaces: "builtins.list[NetworkInterface] | None" = Field(
default_factory=list
)
"""
The network interfaces associated with the container.
"""
healthStatus: "Literal['HEALTHY', 'UNHEALTHY', 'UNKNOWN'] | None" = None
"""
The health status of the container.
If health checks aren't configured for this container in its task definition, then
it reports the health status as ``UNKNOWN``.
"""
managedAgents: "builtins.list[ManagedAgent] | None" = Field(default_factory=list)
"""
The details of any Amazon ECS managed agents associated with the container.
"""
cpu: "str | None" = None
"""
The number of CPU units set for the container.
The value is ``0`` if no value was specified in the container definition
when the task definition was registered.
"""
memory: "str | None" = None
"""
The hard limit (in MiB) of memory set for the container.
"""
memoryReservation: "str | None" = None
"""
The soft limit (in MiB) of memory set for the container.
"""
gpuIds: "builtins.list[str] | None" = Field(default_factory=list)
"""
The IDs of each GPU assigned to the container.
"""
[docs]class ContainerOverride(Boto3Model):
"""
The overrides that are sent to a container. An empty container override can be
passed in. An example of an empty container override is ``{"containerOverrides": ` ]
}``. If a non-empty container override is specified, the ``name`` parameter must be
included.
You can use Secrets Manager or Amazon Web Services Systems Manager Parameter Store to store the sensitive data. For more
information, see [Retrieve secrets through environment
variables <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/secrets-envvar.html>`_ in the Amazon ECS Developer
Guide.
"""
name: "str | None" = None
"""
The name of the container that receives the override.
This parameter is required if any override is specified.
"""
command: "builtins.list[str] | None" = Field(default_factory=list)
"""
The command to send to the container that overrides the default command from the
Docker image or the task definition.
You must also specify a container name.
"""
environment: "builtins.list[KeyValuePair] | None" = Field(default_factory=list)
"""
The environment variables to send to the container.
You can add new environment variables, which are added to the container at launch,
or you can override the existing environment variables from the Docker image or the
task definition. You must also specify a container name.
"""
environmentFiles: "builtins.list[EnvironmentFile] | None" = Field(
default_factory=list
)
"""
A list of files containing the environment variables to pass to a container, instead
of the value from the container definition.
"""
cpu: "int | None" = None
"""
The number of ``cpu`` units reserved for the container, instead of the default value
from the task definition.
You must also specify a container name.
"""
memory: "int | None" = None
"""
The hard limit (in MiB) of memory to present to the container, instead of the
default value from the task definition.
If your container attempts to exceed the memory specified here, the container is
killed. You must also specify a container name.
"""
memoryReservation: "int | None" = None
"""
The soft limit (in MiB) of memory to reserve for the container, instead of the
default value from the task definition.
You must also specify a container name.
"""
resourceRequirements: "builtins.list[ResourceRequirement] | None" = Field(
default_factory=list
)
"""
The type and amount of a resource to assign to a container, instead of the default
value from the task definition.
The only supported resource is a GPU.
"""
[docs]class InferenceAcceleratorOverride(Boto3Model):
"""
Details on an Elastic Inference accelerator task override.
This parameter is used to override the Elastic Inference accelerator specified in
the task definition. For more information, see
`Working with Amazon Elastic Inference on Amazon ECS <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-inference.html>`_
in the *Amazon Elastic Container
Service Developer Guide*.
"""
deviceName: "str | None" = None
"""
The Elastic Inference accelerator device name to override for the task.
This parameter must match a ``deviceName``
specified in the task definition.
"""
deviceType: "str | None" = None
"""
The Elastic Inference accelerator type to use.
"""
[docs]class TaskOverride(Boto3Model):
"""
The overrides that are associated with a task.
"""
containerOverrides: "builtins.list[ContainerOverride] | None" = Field(
default_factory=list
)
"""
One or more container overrides that are sent to a task.
"""
cpu: "str | None" = None
"""
The CPU override for the task.
"""
inferenceAcceleratorOverrides: "builtins.list[InferenceAcceleratorOverride] | None" = Field(
default_factory=list
)
"""
The Elastic Inference accelerator override for the task.
"""
executionRoleArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the task execution role override for the task.
For more information, see
`Amazon ECS task execution IAM role <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_execution_IAM_role.html>`_
in
the *Amazon Elastic Container Service Developer Guide*.
"""
memory: "str | None" = None
"""
The memory override for the task.
"""
taskRoleArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the role that containers in this task can assume.
All containers in this task are granted the permissions that are specified in this
role. For more information, see
`IAM Role for Tasks <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html>`_
in the *Amazon Elastic Container
Service Developer Guide*.
"""
ephemeralStorage: "EphemeralStorage | None" = None
"""
The ephemeral storage setting override for the task.
"""
[docs]class TaskEphemeralStorage(Boto3Model):
"""
The amount of ephemeral storage to allocate for the task.
"""
sizeInGiB: "int | None" = None
"""
The total amount, in GiB, of the ephemeral storage to set for the task.
The minimum supported value is ``20`` GiB and
the maximum supported value is ``200`` GiB.
"""
kmsKeyId: "str | None" = None
"""
Specify an Key Management Service key ID to encrypt the ephemeral storage for the
task.
"""
[docs]class Task(TagsDictMixin, PrimaryBoto3Model):
"""
Details on a task in a cluster.
"""
tag_class: ClassVar[type[Boto3Model]] = ECSTag
manager_class: ClassVar[type[Boto3ModelManager]] = TaskManager
Tags: "builtins.list[ECSTag]" = Field(default_factory=list, alias="tags")
"""
The metadata that you apply to the task to help you categorize and organize the
task.
Each tag consists of a key and an optional value. You define both the key and value.
"""
clusterArn: str
"""
The ARN of the cluster that hosts the task.
"""
platformVersion: "str | None" = "LATEST"
"""
The platform version where your task runs on.
A platform version is only specified for tasks that use the Fargate launch
type. If you didn't specify one, the ``LATEST`` platform version is used. For more information, see `Fargate Platform
Versions <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html>`_ in the *Amazon Elastic
Container Service Developer Guide*.
"""
launchType: "Literal['EC2', 'FARGATE', 'EXTERNAL', 'MANAGED_INSTANCES'] | None" = (
"FARGATE"
)
"""
The infrastructure where your task runs on.
For more information, see
`Amazon ECS launch types <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html>`_
in the *Amazon Elastic Container
Service Developer Guide*.
"""
attachments: "builtins.list[Attachment]" = Field(default_factory=list, frozen=True)
"""
The Elastic Network Adapter that's associated with the task if the task uses the
``awsvpc`` network mode.
"""
attributes: "builtins.list[Attribute]" = Field(default_factory=list, frozen=True)
"""
The attributes of the task.
"""
availabilityZone: str = Field(default=None, frozen=True)
"""
The Availability Zone for the task.
"""
capacityProviderName: str = Field(default=None, frozen=True)
"""
The capacity provider that's associated with the task.
"""
connectivity: Literal["CONNECTED", "DISCONNECTED"] = Field(
default=None, frozen=True
)
"""
The connectivity status of a task.
"""
connectivityAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the task last went into ``CONNECTED`` status.
"""
containerInstanceArn: str = Field(default=None, frozen=True)
"""
The ARN of the container instances that host the task.
"""
containers: "builtins.list[Container]" = Field(default_factory=list, frozen=True)
"""
The containers that's associated with the task.
"""
cpu: str = Field(default=None, frozen=True)
"""
The number of CPU units used by the task as expressed in a task definition.
It can be expressed as an integer using CPU
units (for example, ``1024``). It can also be expressed as a string using vCPUs (for example, ``1 vCPU`` or ``1 vcpu``).
String values are converted to an integer that indicates the CPU units when the task definition is registered.
"""
createdAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the task was created.
More specifically, it's for the time when the task entered
the ``PENDING`` state.
"""
desiredStatus: str = Field(default=None, frozen=True)
"""
The desired status of the task.
For more information, see
`Task Lifecycle <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-lifecycle.html>`_.
"""
enableExecuteCommand: "bool | None" = None
"""
Determines whether execute command functionality is turned on for this task.
If ``true``, execute command functionality
is turned on all the containers in the task.
"""
executionStoppedAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the task execution stopped.
"""
group: "str | None" = None
"""
The name of the task group that's associated with the task.
"""
healthStatus: Literal["HEALTHY", "UNHEALTHY", "UNKNOWN"] = Field(
default=None, frozen=True
)
"""
The health status for the task.
It's determined by the health of the essential containers in the task. If all essential
containers in the task are reporting as ``HEALTHY``, the task status also reports as ``HEALTHY``. If any essential
containers in the task are reporting as ``UNHEALTHY`` or ``UNKNOWN``, the task status also reports as ``UNHEALTHY`` or
``UNKNOWN``.
"""
inferenceAccelerators: "builtins.list[InferenceAccelerator]" = Field(
default_factory=list, frozen=True
)
"""
The Elastic Inference accelerator that's associated with the task.
"""
lastStatus: str = Field(default=None, frozen=True)
"""
The last known status for the task.
For more information, see
`Task Lifecycle <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-lifecycle.html>`_.
"""
memory: str = Field(default=None, frozen=True)
"""
The amount of memory (in MiB) that the task uses as expressed in a task definition.
It can be expressed as an integer
using MiB (for example, ``1024``). If it's expressed as a string using GB (for example, ``1GB`` or ``1 GB``), it's
converted to an integer indicating the MiB when the task definition is registered.
"""
overrides: "TaskOverride | None" = None
"""
One or more container overrides.
"""
platformFamily: str = Field(default=None, frozen=True)
"""
The operating system that your tasks are running on.
A platform family is specified only for tasks that use the Fargate launch type.
"""
pullStartedAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the container image pull began.
"""
pullStoppedAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the container image pull completed.
"""
startedAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the task started.
More specifically, it's for the time when the task transitioned
from the ``PENDING`` state to the ``RUNNING`` state.
"""
startedBy: "str | None" = None
"""
The tag specified when a task is started.
If an Amazon ECS service started the task, the ``startedBy`` parameter
contains the deployment ID of that service.
"""
stopCode: Literal[
"TaskFailedToStart",
"EssentialContainerExited",
"UserInitiated",
"ServiceSchedulerInitiated",
"SpotInterruption",
"TerminationNotice",
] = Field(default=None, frozen=True)
"""
The stop code indicating why a task was stopped.
The ``stoppedReason`` might contain additional details.
"""
stoppedAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the task was stopped.
More specifically, it's for the time when the task
transitioned from the ``RUNNING`` state to the ``STOPPED`` state.
"""
stoppedReason: str = Field(default=None, frozen=True)
"""
The reason that the task was stopped.
"""
stoppingAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the task stops.
More specifically, it's for the time when the task transitions from
the ``RUNNING`` state to ``STOPPING``.
"""
taskArn: str = Field(default=None, frozen=True)
"""
The Amazon Resource Name (ARN) of the task.
"""
taskDefinitionArn: str = Field(default=None, frozen=True)
"""
The ARN of the task definition that creates the task.
"""
version: int = Field(default=None, frozen=True)
"""
The version counter for the task.
Every time a task experiences a change that starts a CloudWatch event, the version
counter is incremented. If you replicate your Amazon ECS task state with CloudWatch Events, you can compare the version
of a task reported by the Amazon ECS API actions with the version reported in CloudWatch Events for the task (inside the
``detail`` object) to verify that the version in your event stream is current.
"""
ephemeralStorage: EphemeralStorage = Field(default=None, frozen=True)
"""
The ephemeral storage settings for the task.
"""
fargateEphemeralStorage: TaskEphemeralStorage = Field(default=None, frozen=True)
"""
The Fargate ephemeral storage settings for the task.
"""
taskDefinition: "str | None" = None
"""
The ``family`` and ``revision`` (``family:revision``) or full ARN of the task
definition to run.
If a ``revision`` isn't
specified, the latest ``ACTIVE`` revision is used.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`taskArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.taskArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`taskArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.taskArn
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`taskArn` attribute.
"""
return hash(self.taskArn)
@property
def serviceName(self) -> str | None:
"""
The name of the service that ran this task, if any.
"""
return self.transform("group", r"^service:(.+)$")
@cached_property
def cluster(self) -> "Cluster | None":
"""
Return the :py:class:`Cluster` object that this task belongs to, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return Cluster.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def task_definition(self) -> "TaskDefinition | None":
"""
Return the :py:class:`TaskDefinition` object that this task uses, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"taskDefinition": self.taskDefinition,
}
)
except AttributeError:
return None
return TaskDefinition.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def container_instance(self) -> "ContainerInstance | None":
"""
Return the :py:class:`ContainerInstance` object that runs this task, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"containerInstance": self.containerInstanceArn,
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return ContainerInstance.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def service(self) -> "Service | None":
"""
Return the :py:class:`Service` object that runs this task, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"service": self.serviceName,
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return Service.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def capacity_provider(self) -> "CapacityProvider | None":
"""
Return the :py:class:`CapacityProvider` object that runs this task, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"capacityProvider": self.capacityProviderName,
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return CapacityProvider.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs]class VersionInfo(Boto3Model):
"""
The Docker and Amazon ECS container agent version information about a container
instance.
"""
agentVersion: "str | None" = None
"""
The version number of the Amazon ECS container agent.
"""
agentHash: "str | None" = None
"""
The Git commit hash for the Amazon ECS container agent build on the `amazon-ecs-agent <https://github.com/aws/amazon-
ecs-agent>`_ GitHub repository.
"""
dockerVersion: "str | None" = None
"""
The Docker version that's running on the container instance.
"""
[docs]class ContainerInstanceResource(Boto3Model):
"""
Describes the resources available for a container instance.
"""
name: "str | None" = None
"""
The name of the resource, such as ``CPU``, ``MEMORY``, ``PORTS``, ``PORTS_UDP``, or
a user-defined resource.
"""
type: "str | None" = None
"""
The type of the resource.
Valid values: ``INTEGER``, ``DOUBLE``, ``LONG``, or ``STRINGSET``.
"""
doubleValue: "float | None" = None
"""
When the ``doubleValue`` type is set, the value of the resource must be a double
precision floating-point type.
"""
longValue: "int | None" = None
"""
When the ``longValue`` type is set, the value of the resource must be an extended
precision floating-point type.
"""
integerValue: "int | None" = None
"""
When the ``integerValue`` type is set, the value of the resource must be an integer.
"""
stringSetValue: "builtins.list[str] | None" = Field(default_factory=list)
"""
When the ``stringSetValue`` type is set, the value of the resource must be a string
type.
"""
[docs]class InstanceHealthCheckResult(Boto3Model):
"""
An object representing the result of a container instance health status check.
"""
type: "Literal['CONTAINER_RUNTIME', 'ACCELERATED_COMPUTE', 'DAEMON'] | None" = None
"""
The type of container instance health status that was verified.
"""
status: "Literal['OK', 'IMPAIRED', 'INSUFFICIENT_DATA', 'INITIALIZING'] | None" = (
None
)
"""
The container instance health status.
"""
statusReason: "str | None" = None
"""
The reason for the container instance health status.
"""
lastUpdated: "datetime | None" = None
"""
The Unix timestamp for when the container instance health status was last updated.
"""
lastStatusChange: "datetime | None" = None
"""
The Unix timestamp for when the container instance health status last changed.
"""
[docs]class ContainerInstanceHealthStatus(Boto3Model):
"""
An object representing the health status of the container instance.
"""
overallStatus: "Literal['OK', 'IMPAIRED', 'INSUFFICIENT_DATA', 'INITIALIZING'] | None" = None
"""
The overall health status of the container instance.
This is an aggregate status of all container instance health checks.
"""
details: "builtins.list[InstanceHealthCheckResult] | None" = Field(
default_factory=list
)
"""
An array of objects representing the details of the container instance health
status.
"""
[docs]class ContainerInstance(
TagsDictMixin, ECSContainerInstanceModelMixin, ReadonlyPrimaryBoto3Model
):
"""
An Amazon EC2 or External instance that's running the Amazon ECS agent and has been
registered with a cluster.
"""
tag_class: ClassVar[type[Boto3Model]] = ECSTag
manager_class: ClassVar[type[Boto3ModelManager]] = ContainerInstanceManager
Tags: "builtins.list[ECSTag]" = Field(default_factory=list, alias="tags")
"""
The metadata that you apply to the container instance to help you categorize and
organize them.
Each tag consists of a key and an optional value. You define both.
"""
containerInstanceArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the container instance.
For more information about the ARN format, see `Amazon
Resource Name (ARN) <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-
ids>`_ in the *Amazon ECS Developer Guide*.
"""
ec2InstanceId: "str | None" = None
"""
The ID of the container instance.
For Amazon EC2 instances, this value is the Amazon EC2 instance ID. For external
instances, this value is the Amazon Web Services Systems Manager managed instance
ID.
"""
capacityProviderName: "str | None" = None
"""
The capacity provider that's associated with the container instance.
"""
version: "int | None" = None
"""
The version counter for the container instance.
Every time a container instance experiences a change that triggers a
CloudWatch event, the version counter is incremented. If you're replicating your Amazon ECS container instance state
with CloudWatch Events, you can compare the version of a container instance reported by the Amazon ECS APIs with the
version reported in CloudWatch Events for the container instance (inside the ``detail`` object) to verify that the
version in your event stream is current.
"""
versionInfo: "VersionInfo | None" = None
"""
The version information for the Amazon ECS container agent and Docker daemon running
on the container instance.
"""
remainingResources: "builtins.list[ContainerInstanceResource] | None" = Field(
default_factory=list
)
"""
For CPU and memory resource types, this parameter describes the remaining CPU and
memory that wasn't already allocated to tasks and is therefore available for new
tasks.
For port resource types, this parameter describes the ports that were
reserved by the Amazon ECS container agent (at instance registration time) and any task containers that have reserved
port mappings on the host (with the ``host`` or ``bridge`` network mode). Any port that's not specified here is
available for new tasks.
"""
registeredResources: "builtins.list[ContainerInstanceResource] | None" = Field(
default_factory=list
)
"""
For CPU and memory resource types, this parameter describes the amount of each
resource that was available on the container instance when the container agent
registered it with Amazon ECS.
This value represents the total amount of CPU and memory that can be allocated on
this container instance to tasks. For port resource types, this parameter describes
the ports that were reserved by the Amazon ECS container agent when it registered
the container instance with Amazon ECS.
"""
status: "str | None" = None
"""
The status of the container instance.
The valid values are ``REGISTERING``, ``REGISTRATION_FAILED``, ``ACTIVE``,
``INACTIVE``, ``DEREGISTERING``, or ``DRAINING``.
"""
statusReason: "str | None" = None
"""
The reason that the container instance reached its current status.
"""
agentConnected: "bool | None" = None
"""
This parameter returns ``true`` if the agent is connected to Amazon ECS.
An instance with an agent that may be unhealthy
or stopped return ``false``. Only instances connected to an agent can accept task placement requests.
"""
runningTasksCount: "int | None" = None
"""
The number of tasks on the container instance that have a desired status
(``desiredStatus``) of ``RUNNING``.
"""
pendingTasksCount: "int | None" = None
"""
The number of tasks on the container instance that are in the ``PENDING`` status.
"""
agentUpdateStatus: "Literal['PENDING', 'STAGING', 'STAGED', 'UPDATING', 'UPDATED', 'FAILED'] | None" = None
"""
The status of the most recent agent update.
If an update wasn't ever requested, this value is ``NULL``.
"""
attributes: "builtins.list[Attribute] | None" = Field(default_factory=list)
"""
The attributes set for the container instance, either by the Amazon ECS container agent at instance registration or
manually with the `PutAttributes <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_PutAttributes.html>`_
operation.
"""
registeredAt: "datetime | None" = None
"""
The Unix timestamp for the time when the container instance was registered.
"""
attachments: "builtins.list[Attachment] | None" = Field(default_factory=list)
"""
The resources attached to a container instance, such as an elastic network
interface.
"""
healthStatus: "ContainerInstanceHealthStatus | None" = None
"""
An object representing the health status of the container instance.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`containerInstanceArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.containerInstanceArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the
:py:attr:`containerInstanceArn` attribute.
Returns:
The ARN of the model instance.
"""
return self.containerInstanceArn
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`containerInstanceArn` attribute.
"""
return hash(self.containerInstanceArn)
@property
def clusterName(self) -> str | None:
"""
The name of the cluster that houses this task, if any.
"""
return self.transform(
"containerInstanceArn", r":container-instance/(.+)/[0-9a-f]+$"
)
@property
def name(self) -> str | None:
"""
The name of the cluster that houses this task, if any.
"""
return self.transform(
"containerInstanceArn", r":container-instance/.+/([0-9a-f]+)$"
)
@cached_property
def instance(self) -> "Instance | None":
"""
Return the :py:class:`Instance` object that this container instance represents,
if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"InstanceId": self.ec2InstanceId,
}
)
except AttributeError:
return None
return Instance.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@property
def tasks(self) -> "list[Task] | None":
"""
Return the ARNs of :py:class:`Task` objects that run on this container instance,
if any.
"""
try:
pk = OrderedDict(
{
"cluster": self.clusterName,
"containerInstance": self.containerInstanceArn,
"desiredStatus": "RUNNING",
}
)
except AttributeError:
return []
return Task.objects.using(self.session).list(**pk) # type: ignore[arg-type]
@cached_property
def cluster(self) -> "Cluster | None":
"""
Return the :py:class:`Cluster` object that this container instance belongs to,
if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"cluster": self.clusterName,
}
)
except AttributeError:
return None
return Cluster.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def capacity_provider(self) -> "CapacityProvider | None":
"""
Return the :py:class:`CapacityProvider` object associated with this container
instance, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"capacityProvider": self.capacityProviderName,
"cluster": self.clusterName,
}
)
except AttributeError:
return None
return CapacityProvider.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs]class ContainerImage(Boto3Model):
"""
The details about the container image a service revision uses.
To ensure that all tasks in a service use the same container image, Amazon ECS
resolves container image names and any image tags specified in the task definition
to container image digests.
After the container image digest has been established, Amazon ECS uses the digest to
start any other desired tasks, and for any future service and service revision
updates. This leads to all tasks in a service always running identical container
images, resulting in version consistency for your software. For more information,
see
`Container image resolution <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-ecs.html#deployment-container-
image-stability>`_ in the Amazon ECS Developer Guide.
"""
containerName: "str | None" = None
"""
The name of the container.
"""
imageDigest: "str | None" = None
"""
The container image digest.
"""
image: "str | None" = None
"""
The container image.
"""
[docs]class ServiceRevisionLoadBalancer(Boto3Model):
"""
The resolved load balancer configuration for a service revision.
This includes information about which target groups serve traffic and which listener
rules direct traffic to them.
"""
targetGroupArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the target group associated with the service
revision.
"""
productionListenerRule: "str | None" = None
"""
The Amazon Resource Name (ARN) of the production listener rule or listener that
directs traffic to the target group associated with the service revision.
"""
[docs]class ResolvedConfiguration(Boto3Model):
"""
The resolved configuration for a service revision, which contains the actual
resources your service revision uses, such as which target groups serve traffic.
"""
loadBalancers: "builtins.list[ServiceRevisionLoadBalancer] | None" = Field(
default_factory=list
)
"""
The resolved load balancer configuration for the service revision.
This includes information about which target groups serve traffic and which listener
rules direct traffic to them.
"""
[docs]class ManagedLoadBalancer(Boto3Model):
"""
The Application Load Balancer associated with the Express service.
"""
arn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the load balancer.
"""
status: Literal["PROVISIONING", "ACTIVE", "DEPROVISIONING", "DELETED", "FAILED"]
"""
The status of the load balancer.
"""
statusReason: "str | None" = None
"""
Information about why the load balancer is in the current status.
"""
updatedAt: datetime
"""
The Unix timestamp for when this load balancer was most recently updated.
"""
scheme: str
"""
The scheme of the load balancer.
By default, the scheme of the load balancer is ``internet-facing``.
"""
subnetIds: "builtins.list[str] | None" = Field(default_factory=list)
"""
The IDs of the subnets associated with the load balancer.
"""
securityGroupIds: "builtins.list[str] | None" = Field(default_factory=list)
"""
The IDs of the security groups associated with the load balancer.
"""
[docs]class ManagedSecurityGroup(Boto3Model):
"""
A security group associated with the Express service.
"""
arn: "str | None" = None
"""
The ARN of the security group.
"""
status: Literal["PROVISIONING", "ACTIVE", "DEPROVISIONING", "DELETED", "FAILED"]
"""
The status of the security group.
"""
statusReason: "str | None" = None
"""
Information about why the security group is in the current status.
"""
updatedAt: datetime
"""
The Unix timestamp for when the security group was last updated.
"""
[docs]class ManagedCertificate(Boto3Model):
"""
The ACM certificate associated with the HTTPS domain created for the Express
service.
"""
arn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the ACM certificate.
"""
status: Literal["PROVISIONING", "ACTIVE", "DEPROVISIONING", "DELETED", "FAILED"]
"""
The status of the ACM; certificate.
"""
statusReason: "str | None" = None
"""
Information about why the ACM certificate is in the current status.
"""
updatedAt: datetime
"""
The Unix timestamp for when the ACM certificate was last updated.
"""
domainName: str
"""
The fully qualified domain name (FQDN) that is secured with this ACM certificate.
"""
[docs]class ManagedListener(Boto3Model):
"""
The listeners associated with the Express service's Application Load Balancer.
"""
arn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the load balancer listener.
"""
status: Literal["PROVISIONING", "ACTIVE", "DEPROVISIONING", "DELETED", "FAILED"]
"""
The status of the load balancer listener.
"""
statusReason: "str | None" = None
"""
Informaion about why the load balancer listener is in the current status.
"""
updatedAt: datetime
"""
The Unix timestamp for when this listener was most recently updated.
"""
[docs]class ManagedListenerRule(Boto3Model):
"""
The listener rule associated with the Express service's Application Load Balancer.
"""
arn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the load balancer listener rule.
"""
status: Literal["PROVISIONING", "ACTIVE", "DEPROVISIONING", "DELETED", "FAILED"]
"""
The status of the load balancer listener rule.
"""
statusReason: "str | None" = None
"""
Information about why the load balancer listener rule is in the current status.
"""
updatedAt: datetime
"""
The Unix timestamp for when this listener rule was most recently updated.
"""
[docs]class ManagedTargetGroup(Boto3Model):
"""
The target group associated with the Express service's Application Load Balancer.
For more information about load balancer target groups, see
`CreateTargetGroup <https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateTargetGroup.html>`_
in
the *Elastic Load Balancing API Reference*
"""
arn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the target group.
"""
status: Literal["PROVISIONING", "ACTIVE", "DEPROVISIONING", "DELETED", "FAILED"]
"""
The status of the target group.
"""
statusReason: "str | None" = None
"""
Information about why the target group is in the current status.
"""
updatedAt: datetime
"""
The Unix timestamp for when the target group was last updated.
"""
healthCheckPath: str
"""
The destination for health checks on the targets.
"""
healthCheckPort: int
"""
The port the load balancer uses when performing health checks on targets.
"""
port: int
"""
The port on which the targets receive traffic.
"""
[docs]class ManagedIngressPath(Boto3Model):
"""
The entry point into the Express service.
"""
accessType: Literal["PUBLIC", "PRIVATE"]
"""
The type of access to the endpoint for the Express service.
"""
endpoint: str
"""
The endpoint for access to the Express service.
"""
loadBalancer: "ManagedLoadBalancer | None" = None
"""
The Application Load Balancer associated with the Express service.
"""
loadBalancerSecurityGroups: "builtins.list[ManagedSecurityGroup] | None" = Field(
default_factory=list
)
"""
The security groups associated with the Application Load Balancer.
"""
certificate: "ManagedCertificate | None" = None
"""
The ACM certificate for the Express service's domain.
"""
listener: "ManagedListener | None" = None
"""
The listeners associated with the Application Load Balancer.
"""
rule: "ManagedListenerRule | None" = None
"""
The listener rules for the Application Load Balancer.
"""
targetGroups: "builtins.list[ManagedTargetGroup] | None" = Field(
default_factory=list
)
"""
The target groups associated with the Application Load Balancer.
"""
[docs]class ManagedScalableTarget(Boto3Model):
"""
Represents a scalable target.
"""
arn: "str | None" = None
"""
The ARN of the scalable target.
"""
status: Literal["PROVISIONING", "ACTIVE", "DEPROVISIONING", "DELETED", "FAILED"]
"""
The status of the scalable target.
"""
statusReason: "str | None" = None
"""
Information about why the scalable target is in the current status.
"""
updatedAt: datetime
"""
The Unix timestamp for when the target was most recently updated.
"""
minCapacity: int
"""
The minimum value to scale to in response to a scale-in activity.
"""
maxCapacity: int
"""
The maximum value to scale to in response to a scale-out activity.
"""
[docs]class ManagedApplicationAutoScalingPolicy(Boto3Model):
"""
The Application Auto Scaling policy created by Amazon ECS when you create an Express
service.
"""
arn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the Application Auto Scaling policy associated
with the Express service.
"""
status: Literal["PROVISIONING", "ACTIVE", "DEPROVISIONING", "DELETED", "FAILED"]
"""
The status of Application Auto Scaling policy creation.
"""
statusReason: "str | None" = None
"""
Information about why the Application Auto Scaling policy is in the current status.
"""
updatedAt: datetime
"""
The Unix timestamp for when the Application Auto Scaling policy was last updated.
"""
policyType: str
"""
The type of Application Auto Scaling policy associated with the Express service.
Valid values are
``TargetTrackingScaling``, ``StepScaling``, and ``PredictiveScaling``.
"""
targetValue: float
"""
The target value for the auto scaling metric.
"""
metric: str
"""
The metric used for auto scaling decisions.
The available metrics are ``ECSServiceAverageCPUUtilization``,
``ECSServiceAverageMemoryUtilization``, and ``ALBRequestCOuntPerTarget``.
"""
[docs]class ManagedAutoScaling(Boto3Model):
"""
The auto scaling configuration created by Amazon ECS for an Express service.
"""
scalableTarget: "ManagedScalableTarget | None" = None
"""
Represents a scalable target.
"""
applicationAutoScalingPolicies: "builtins.list[ManagedApplicationAutoScalingPolicy] | None" = Field(
default_factory=list
)
"""
The policy used for auto scaling.
"""
[docs]class ManagedMetricAlarm(Boto3Model):
"""
The CloudWatch metric alarm associated with the Express service's scaling policy.
"""
arn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the CloudWatch metric alarm.
"""
status: Literal["PROVISIONING", "ACTIVE", "DEPROVISIONING", "DELETED", "FAILED"]
"""
The status of the CloudWatch metric alarm.
"""
statusReason: "str | None" = None
"""
Information about why the CloudWatch metric alarm is in the current status.
"""
updatedAt: datetime
"""
The Unix timestamp for when the CloudWatch metric alarm was last updated.
"""
[docs]class ManagedLogGroup(Boto3Model):
"""
The Cloudwatch Log Group created by Amazon ECS for an Express service.
"""
arn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the Cloudwatch Log Group associated with the
Express service.
"""
status: Literal["PROVISIONING", "ACTIVE", "DEPROVISIONING", "DELETED", "FAILED"]
"""
The status of the Cloudwatch LogGroup.
"""
statusReason: "str | None" = None
"""
Information about why the Cloudwatch LogGroup is in the current status.
"""
updatedAt: datetime
"""
The Unix timestamp for when the Cloudwatch LogGroup was last updated.
"""
logGroupName: str
"""
The name of the Cloudwatch Log Group associated with the Express service.
"""
[docs]class ECSManagedResources(Boto3Model):
"""
Represents the Amazon Web Services resources managed by Amazon ECS for an Express
service, including ingress paths, auto-scaling policies, metric alarms, and security
groups.
"""
ingressPaths: "builtins.list[ManagedIngressPath] | None" = Field(
default_factory=list
)
"""
The ingress paths and endpoints for the Express service.
"""
autoScaling: "ManagedAutoScaling | None" = None
"""
The auto-scaling configuration and policies for the Express service.
"""
metricAlarms: "builtins.list[ManagedMetricAlarm] | None" = Field(
default_factory=list
)
"""
The CloudWatch metric alarms associated with the Express service.
"""
serviceSecurityGroups: "builtins.list[ManagedSecurityGroup] | None" = Field(
default_factory=list
)
"""
The security groups managed by the Express service.
"""
logGroups: "builtins.list[ManagedLogGroup] | None" = Field(default_factory=list)
"""
The log groups managed by the Express service.
"""
[docs]class ServiceRevision(ReadonlyPrimaryBoto3Model):
"""
Information about the service revision.
A service revision contains a record of the workload configuration Amazon ECS is
attempting to deploy. Whenever you create or deploy a service, Amazon ECS
automatically creates and captures the configuration that you're trying to deploy in
the service revision. For information about service revisions, see
`Amazon ECS service revisions <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-revision.html>`_
in the **Amazon Elastic
Container Service Developer Guide** .
"""
manager_class: ClassVar[type[Boto3ModelManager]] = ServiceRevisionManager
serviceRevisionArn: "str | None" = None
"""
The ARN of the service revision.
"""
serviceArn: "str | None" = None
"""
The ARN of the service for the service revision.
"""
clusterArn: "str | None" = None
"""
The ARN of the cluster that hosts the service.
"""
taskDefinition: "str | None" = None
"""
The task definition the service revision uses.
"""
capacityProviderStrategy: "builtins.list[CapacityProviderStrategyItem] | None" = (
Field(default_factory=list)
)
"""
The capacity provider strategy the service revision uses.
"""
launchType: "Literal['EC2', 'FARGATE', 'EXTERNAL', 'MANAGED_INSTANCES'] | None" = (
None
)
"""
The launch type the service revision uses.
"""
platformVersion: "str | None" = None
"""
For the Fargate launch type, the platform version the service revision uses.
"""
platformFamily: "str | None" = None
"""
The platform family the service revision uses.
"""
loadBalancers: "builtins.list[LoadBalancerConfiguration] | None" = Field(
default_factory=list
)
"""
The load balancers the service revision uses.
"""
serviceRegistries: "builtins.list[ServiceRegistry] | None" = Field(
default_factory=list
)
"""
The service registries (for Service Discovery) the service revision uses.
"""
networkConfiguration: "NetworkConfiguration | None" = None
"""
The network configuration for a task or service.
"""
containerImages: "builtins.list[ContainerImage] | None" = Field(
default_factory=list
)
"""
The container images the service revision uses.
"""
guardDutyEnabled: "bool | None" = None
"""
Indicates whether Runtime Monitoring is turned on.
"""
serviceConnectConfiguration: "ServiceConnectConfiguration | None" = None
"""
The Service Connect configuration of your Amazon ECS service.
The configuration for this service to discover and connect to services, and be
discovered by, and connected from, other services within a namespace.
"""
volumeConfigurations: "builtins.list[ServiceVolumeConfiguration] | None" = Field(
default_factory=list
)
"""
The volumes that are configured at deployment that the service revision uses.
"""
fargateEphemeralStorage: "DeploymentEphemeralStorage | None" = None
"""
The amount of ephemeral storage to allocate for the deployment.
"""
createdAt: "datetime | None" = None
"""
The time that the service revision was created.
The format is yyyy-mm-dd HH:mm:ss.SSSSS.
"""
vpcLatticeConfigurations: "builtins.list[VpcLatticeConfiguration] | None" = Field(
default_factory=list
)
"""
The VPC Lattice configuration for the service revision.
"""
resolvedConfiguration: "ResolvedConfiguration | None" = None
"""
The resolved configuration for the service revision which contains the actual
resources your service revision uses, such as which target groups serve traffic.
"""
ecsManagedResources: "ECSManagedResources | None" = None
"""
The resources created and managed by Amazon ECS when you create an Express service
for Amazon ECS.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`serviceRevisionArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.serviceRevisionArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the
:py:attr:`serviceRevisionArn` attribute.
Returns:
The ARN of the model instance.
"""
return self.serviceRevisionArn
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`serviceRevisionArn` attribute.
"""
return hash(self.serviceRevisionArn)
@cached_property
def service(self) -> "Service | None":
"""
Return the :py:class:`Service` object for this service revision, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"service": self.serviceArn,
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return Service.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def cluster(self) -> "Cluster | None":
"""
Return the :py:class:`Cluster` object for this service revision, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return Cluster.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def task_definition(self) -> "TaskDefinition | None":
"""
Return the :py:class:`TaskDefinition` object for this service revision, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"taskDefinition": self.taskDefinition,
}
)
except AttributeError:
return None
return TaskDefinition.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs]class ServiceRevisionSummary(Boto3Model):
"""
The information about the number of requested, pending, and running tasks for a
service revision.
"""
arn: "str | None" = None
"""
The ARN of the service revision.
"""
requestedTaskCount: "int | None" = None
"""
The number of requested tasks for the service revision.
"""
runningTaskCount: "int | None" = None
"""
The number of running tasks for the service revision.
"""
pendingTaskCount: "int | None" = None
"""
The number of pending tasks for the service revision.
"""
requestedTestTrafficWeight: "float | None" = None
"""
The percentage of test traffic that is directed to this service revision.
This value represents a snapshot of the traffic distribution and may not reflect
real-time changes during active deployments. Valid values are 0.0 to 100.0.
"""
requestedProductionTrafficWeight: "float | None" = None
"""
The percentage of production traffic that is directed to this service revision.
This value represents a snapshot of the traffic distribution and may not reflect
real-time changes during active deployments. Valid values are 0.0 to 100.0.
"""
[docs]class Rollback(Boto3Model):
"""
Information about the service deployment rollback.
"""
reason: "str | None" = None
"""
The reason the rollback happened.
For example, the circuit breaker initiated the rollback operation.
"""
startedAt: "datetime | None" = None
"""
Time time that the rollback started.
The format is yyyy-MM-dd HH:mm:ss.SSSSSS.
"""
serviceRevisionArn: "str | None" = None
"""
The ARN of the service revision deployed as part of the rollback.
"""
[docs]class ServiceDeploymentCircuitBreaker(Boto3Model):
"""
Information about the circuit breaker used to determine when a service deployment
has failed.
The deployment circuit breaker is the rolling update mechanism that determines if
the tasks reach a steady state. The deployment circuit breaker has an option that
will automatically roll back a failed deployment to the last cpompleted service
revision. For more information, see
`How the Amazon ECS deployment circuit breaker detects failures <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-circuit-breaker.html>`_
in the *Amazon
ECS Developer Guide*.
"""
status: "Literal['TRIGGERED', 'MONITORING', 'MONITORING_COMPLETE', 'DISABLED'] | None" = None
"""
The circuit breaker status.
Amazon ECS is not using the circuit breaker for service deployment failures when the status
is ``DISABLED``.
"""
failureCount: "int | None" = None
"""
The number of times the circuit breaker detected a service deploymeny failure.
"""
threshold: "int | None" = None
"""
The threshhold which determines that the service deployment failed.
"""
[docs]class ServiceDeploymentAlarms(Boto3Model):
"""
The CloudWatch alarms used to determine a service deployment failed.
Amazon ECS considers the service deployment as failed when any of the alarms move to the ``ALARM`` state. For more
information, see `How CloudWatch alarms detect Amazon ECS deployment
failures <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-alarm-failure.html>`_ in the Amazon ECS
Developer Guide.
"""
status: "Literal['TRIGGERED', 'MONITORING', 'MONITORING_COMPLETE', 'DISABLED'] | None" = None
"""
The status of the alarms check.
Amazon ECS is not using alarms for service deployment failures when the status is
``DISABLED``.
"""
alarmNames: "builtins.list[str] | None" = Field(default_factory=list)
"""
The name of the CloudWatch alarms that determine when a service deployment failed.
A "," separates the alarms.
"""
triggeredAlarmNames: "builtins.list[str] | None" = Field(default_factory=list)
"""
One or more CloudWatch alarm names that have been triggered during the service
deployment.
A "," separates the alarm names.
"""
[docs]class ServiceDeployment(ReadonlyPrimaryBoto3Model):
"""
Information about the service deployment.
Service deployments provide a comprehensive view of your deployments. For
information about service deployments, see
`View service history using Amazon ECS service deployments <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-deployment.html>`_
in the **Amazon
Elastic Container Service Developer Guide** .
"""
manager_class: ClassVar[type[Boto3ModelManager]] = ServiceDeploymentManager
serviceDeploymentArn: "str | None" = None
"""
The ARN of the service deployment.
"""
serviceArn: "str | None" = None
"""
The ARN of the service for this service deployment.
"""
clusterArn: "str | None" = None
"""
The ARN of the cluster that hosts the service.
"""
createdAt: "datetime | None" = None
"""
The time the service deployment was created.
The format is yyyy-MM-dd HH:mm:ss.SSSSSS.
"""
startedAt: "datetime | None" = None
"""
The time the service deployment statred.
The format is yyyy-MM-dd HH:mm:ss.SSSSSS.
"""
finishedAt: "datetime | None" = None
"""
The time the service deployment finished.
The format is yyyy-MM-dd HH:mm:ss.SSSSSS.
"""
stoppedAt: "datetime | None" = None
"""
The time the service deployment stopped.
The format is yyyy-MM-dd HH:mm:ss.SSSSSS.
"""
updatedAt: "datetime | None" = None
"""
The time that the service deployment was last updated.
The format is yyyy-MM-dd HH:mm:ss.SSSSSS.
"""
sourceServiceRevisions: "builtins.list[ServiceRevisionSummary] | None" = Field(
default_factory=list
)
"""
The currently deployed workload configuration.
"""
targetServiceRevision: "ServiceRevisionSummary | None" = None
"""
The workload configuration being deployed.
"""
status: "Literal['PENDING', 'SUCCESSFUL', 'STOPPED', 'STOP_REQUESTED', 'IN_PROGRESS', 'ROLLBACK_REQUESTED', 'ROLLBACK_IN_PROGRESS', 'ROLLBACK_SUCCESSFUL', 'ROLLBACK_FAILED'] | None" = None
"""
The service deployment state.
"""
statusReason: "str | None" = None
"""
Information about why the service deployment is in the current status.
For example, the circuit breaker detected a failure.
"""
lifecycleStage: "Literal['RECONCILE_SERVICE', 'PRE_SCALE_UP', 'SCALE_UP', 'POST_SCALE_UP', 'TEST_TRAFFIC_SHIFT', 'POST_TEST_TRAFFIC_SHIFT', 'PRODUCTION_TRAFFIC_SHIFT', 'POST_PRODUCTION_TRAFFIC_SHIFT', 'BAKE_TIME', 'CLEAN_UP'] | None" = None
"""
The current lifecycle stage of the deployment.
Possible values include:
"""
deploymentConfiguration: "DeploymentConfiguration | None" = None
"""
Optional deployment parameters that control how many tasks run during a deployment
and the ordering of stopping and starting tasks.
"""
rollback: "Rollback | None" = None
"""
The rollback options the service deployment uses when the deployment fails.
"""
deploymentCircuitBreaker: "ServiceDeploymentCircuitBreaker | None" = None
"""
The circuit breaker configuration that determines a service deployment failed.
"""
alarms: "ServiceDeploymentAlarms | None" = None
"""
The CloudWatch alarms that determine when a service deployment fails.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`serviceDeploymentArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.serviceDeploymentArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the
:py:attr:`serviceDeploymentArn` attribute.
Returns:
The ARN of the model instance.
"""
return self.serviceDeploymentArn
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`serviceDeploymentArn` attribute.
"""
return hash(self.serviceDeploymentArn)
@cached_property
def service(self) -> "Service | None":
"""
Return the :py:class:`Service` object that owns this deployment, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"service": self.serviceArn,
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return Service.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def cluster(self) -> "Cluster | None":
"""
Return the :py:class:`Cluster` object that owns this deployment, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return Cluster.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def target_service_revision(self) -> "ServiceRevision | None":
"""
Return the target :py:class:`ServiceRevision` object for this deployment, if
any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"serviceRevisionArn": self.targetServiceRevision.arn,
}
)
except AttributeError:
return None
return ServiceRevision.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def source_service_revisions(self) -> "list[ServiceRevision] | None":
"""
Return the source :py:class:`ServiceRevision` objects for this deployment, if
any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"serviceRevisionArns": [
revision.arn
for revision in self.sourceServiceRevisions
if revision.arn
],
}
)
except AttributeError:
return []
return ServiceRevision.objects.using(self.session).list(**pk) # type: ignore[arg-type]
@cached_property
def target_task_definition(self) -> "TaskDefinition | None":
"""
Return the :py:class:`TaskDefinition` object that this deployment uses, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"taskDefinition": self.target_service_revision.taskDefinition,
}
)
except AttributeError:
return None
return TaskDefinition.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs]class DaemonCapacityProvider(Boto3Model):
"""
Information about a capacity provider associated with a daemon revision.
"""
arn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the capacity provider.
"""
runningCount: "int | None" = None
"""
The number of daemon tasks running on this capacity provider.
"""
[docs]class DaemonRevisionDetail(Boto3Model):
"""
Details about a daemon revision, including the running task counts per capacity
provider.
"""
arn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the daemon revision.
"""
capacityProviders: "builtins.list[DaemonCapacityProvider] | None" = Field(
default_factory=list
)
"""
The capacity providers associated with this daemon revision.
"""
totalRunningCount: "int | None" = None
"""
The total number of daemon tasks running for this revision.
"""
[docs]class Daemon(TagsDictMixin, PrimaryBoto3Model):
"""
The detailed information about a daemon.
"""
tag_class: ClassVar[type[Boto3Model]] = ECSTag | None
manager_class: ClassVar[type[Boto3ModelManager]] = DaemonManager
daemonArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the daemon.
"""
clusterArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the cluster that the daemon is running in.
"""
status: "Literal['ACTIVE', 'DELETE_IN_PROGRESS'] | None" = None
"""
The status of the daemon.
"""
currentRevisions: "builtins.list[DaemonRevisionDetail] | None" = Field(
default_factory=list
)
"""
The current daemon revision details, including the running task counts per capacity
provider.
"""
deploymentArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the most recent daemon deployment.
"""
createdAt: "datetime | None" = None
"""
The Unix timestamp for the time when the daemon was created.
"""
updatedAt: "datetime | None" = None
"""
The Unix timestamp for the time when the daemon was last updated.
"""
daemonName: str | None = None
"""
The name to assign to the daemon when creating it.
"""
daemonTaskDefinitionArn: str | None = None
"""
The daemon task definition ARN to use for this daemon.
"""
capacityProviderArns: builtins.list[str] | None = Field(default_factory=list)
"""
The capacity provider ARNs that back this daemon.
"""
deploymentConfiguration: dict[str, builtins.object] | None = Field(
default_factory=dict
)
"""
The deployment configuration to apply when creating or updating this daemon.
"""
propagateTags: str | None = None
"""
Controls how tags are propagated to daemon tasks.
"""
enableECSManagedTags: bool | None = None
"""
Whether ECS managed tags are enabled for daemon tasks.
"""
enableExecuteCommand: bool | None = None
"""
Whether ECS Exec is enabled for daemon tasks.
"""
Tags: builtins.list[ECSTag] | None = Field(default_factory=list)
"""
The tags associated with this daemon.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`daemonArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.daemonArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`daemonArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.daemonArn
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`daemonArn` attribute.
"""
return hash(self.daemonArn)
@cached_property
def cluster(self) -> "Cluster | None":
"""
Return the :py:class:`Cluster` object that owns this daemon, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return Cluster.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def current_revisions(self) -> "list[DaemonRevision] | None":
"""
Return the current :py:class:`DaemonRevision` objects for this daemon, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"daemonRevisionArns": [
revision.arn
for revision in self.currentRevisions
if revision.arn
],
}
)
except AttributeError:
return []
return DaemonRevision.objects.using(self.session).list(**pk) # type: ignore[arg-type]
[docs]class DaemonLinuxParameters(Boto3Model):
"""
The Linux-specific options that are applied to the daemon container, such as Linux
kernel capabilities.
"""
capabilities: "KernelCapabilities | None" = None
"""
The Linux capabilities for the container that are added to or dropped from the
default configuration provided by Docker.
"""
devices: "builtins.list[Device] | None" = Field(default_factory=list)
"""
Any host devices to expose to the container.
"""
initProcessEnabled: "bool | None" = None
"""
Run an ``init`` process inside the container that forwards signals and reaps
processes.
"""
tmpfs: "builtins.list[Tmpfs] | None" = Field(default_factory=list)
"""
The container path, mount options, and size (in MiB) of the tmpfs mount.
"""
[docs]class DaemonContainerDefinition(Boto3Model):
"""
A container definition for a daemon task.
Daemon container definitions describe the containers that run as part of a daemon
task on container instances managed by capacity providers.
"""
name: "str | None" = None
"""
The name of the container.
Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are
allowed.
"""
image: str
"""
The image used to start the container.
This string is passed directly to the Docker daemon. Images in the Docker Hub
registry are available by default. Other repositories are specified with either ``repository-url/image:tag`` or
``repository-url/image@digest`` .
"""
memory: "int | None" = None
"""
The amount (in MiB) of memory to present to the container.
If the container attempts to exceed the memory specified here, the container is
killed.
"""
memoryReservation: "int | None" = None
"""
The soft limit (in MiB) of memory to reserve for the container.
"""
repositoryCredentials: "RepositoryCredentials | None" = None
"""
The private repository authentication credentials to use.
"""
healthCheck: "HealthCheck | None" = None
"""
The container health check command and associated configuration parameters for the
container.
"""
cpu: "int | None" = None
"""
The number of ``cpu`` units reserved for the container.
"""
essential: "bool | None" = None
"""
If the ``essential`` parameter of a container is marked as ``true``, and that
container fails or stops for any reason, all other containers that are part of the
task are stopped.
"""
entryPoint: "builtins.list[str] | None" = Field(default_factory=list)
"""
The entry point that's passed to the container.
"""
command: "builtins.list[str] | None" = Field(default_factory=list)
"""
The command that's passed to the container.
"""
workingDirectory: "str | None" = None
"""
The working directory to run commands inside the container in.
"""
environmentFiles: "builtins.list[EnvironmentFile] | None" = Field(
default_factory=list
)
"""
A list of files containing the environment variables to pass to a container.
"""
environment: "builtins.list[KeyValuePair] | None" = Field(default_factory=list)
"""
The environment variables to pass to a container.
"""
secrets: "builtins.list[ECSContainerDefinitionSecret] | None" = Field(
default_factory=list
)
"""
The secrets to pass to the container.
"""
readonlyRootFilesystem: "bool | None" = None
"""
When this parameter is true, the container is given read-only access to its root
file system.
"""
mountPoints: "builtins.list[MountPoint] | None" = Field(default_factory=list)
"""
The mount points for data volumes in your container.
"""
logConfiguration: "LogConfiguration | None" = None
"""
The log configuration specification for the container.
"""
firelensConfiguration: "FirelensConfiguration | None" = None
"""
The FireLens configuration for the container.
This is used to specify and configure a log router for container logs.
"""
privileged: "bool | None" = None
"""
When this parameter is true, the container is given elevated privileges on the host
container instance (similar to the ``root`` user).
"""
user: "str | None" = None
"""
The user to use inside the container.
"""
ulimits: "builtins.list[Ulimit] | None" = Field(default_factory=list)
"""
A list of ``ulimits`` to set in the container.
"""
linuxParameters: "DaemonLinuxParameters | None" = None
"""
Linux-specific modifications that are applied to the container configuration, such
as Linux kernel capabilities.
"""
dependsOn: "builtins.list[ContainerDependency] | None" = Field(default_factory=list)
"""
The dependencies defined for container startup and shutdown.
A container can contain multiple dependencies on other containers in a task
definition.
"""
startTimeout: "int | None" = None
"""
Time duration (in seconds) to wait before giving up on resolving dependencies for a
container.
"""
stopTimeout: "int | None" = None
"""
Time duration (in seconds) to wait before the container is forcefully killed if it
doesn't exit normally on its own.
"""
systemControls: "builtins.list[SystemControl] | None" = Field(default_factory=list)
"""
A list of namespaced kernel parameters to set in the container.
"""
interactive: "bool | None" = None
"""
When this parameter is ``true``, you can deploy containerized applications that
require ``stdin`` or a ``tty`` to be allocated.
"""
pseudoTerminal: "bool | None" = None
"""
When this parameter is ``true``, a TTY is allocated.
"""
restartPolicy: "ContainerRestartPolicy | None" = None
"""
The restart policy for the container.
When you set up a restart policy, Amazon ECS can restart the container without
needing to replace the task.
"""
[docs]class DaemonVolume(Boto3Model):
"""
A data volume definition for a daemon task.
"""
name: "str | None" = None
"""
The name of the volume.
Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are
allowed.
"""
host: "HostVolumeProperties | None" = None
"""
The contents of the ``host`` parameter determine whether your bind mount host volume
persists on the host container instance and where it's stored.
"""
[docs]class DaemonTaskDefinition(TagsDictMixin, PrimaryBoto3Model):
"""
The details of a daemon task definition.
A daemon task definition is a template that describes the containers that form a
daemon. Daemons deploy cross-cutting software agents independently across your
Amazon ECS infrastructure.
"""
tag_class: ClassVar[type[Boto3Model]] = ECSTag | None
manager_class: ClassVar[type[Boto3ModelManager]] = DaemonTaskDefinitionManager
daemonTaskDefinitionArn: str = Field(default=None, frozen=True)
"""
The full Amazon Resource Name (ARN) of the daemon task definition.
"""
family: "str | None" = None
"""
The name of a family that this daemon task definition is registered to.
"""
revision: int = Field(default=None, frozen=True)
"""
The revision of the daemon task in a particular family.
The revision is a version number of a daemon task definition in
a family. When you register a daemon task definition for the first time, the revision is ``1``. Each time that you
register a new revision of a daemon task definition in the same family, the revision value always increases by one.
"""
taskRoleArn: "str | None" = None
"""
The short name or full Amazon Resource Name (ARN) of the IAM role that grants
containers in the daemon task permission to call Amazon Web Services APIs on your
behalf.
"""
executionRoleArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the task execution role that grants the Amazon ECS
container agent permission to make Amazon Web Services API calls on your behalf.
"""
containerDefinitions: "builtins.list[DaemonContainerDefinition] | None" = Field(
default_factory=list
)
"""
A list of container definitions in JSON format that describe the containers that
make up the daemon task.
"""
volumes: "builtins.list[DaemonVolume] | None" = Field(default_factory=list)
"""
The list of data volume definitions for the daemon task.
"""
cpu: "str | None" = None
"""
The number of CPU units used by the daemon task.
"""
memory: "str | None" = None
"""
The amount of memory (in MiB) used by the daemon task.
"""
status: Literal["ACTIVE", "DELETE_IN_PROGRESS", "DELETED"] = Field(
default=None, frozen=True
)
"""
The status of the daemon task definition.
The valid values are ``ACTIVE``, ``DELETE_IN_PROGRESS``, and ``DELETED``.
"""
registeredAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the daemon task definition was registered.
"""
deleteRequestedAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for the time when the daemon task definition delete was
requested.
"""
registeredBy: str = Field(default=None, frozen=True)
"""
The principal that registered the daemon task definition.
"""
Tags: builtins.list[ECSTag] | None = Field(default_factory=list)
"""
The tags associated with this daemon task definition.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`daemonTaskDefinitionArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.daemonTaskDefinitionArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the
:py:attr:`daemonTaskDefinitionArn` attribute.
Returns:
The ARN of the model instance.
"""
return self.daemonTaskDefinitionArn
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`daemonTaskDefinitionArn` attribute.
"""
return hash(self.daemonTaskDefinitionArn)
[docs]class DaemonContainerImage(Boto3Model):
"""
The details about the container image a daemon revision uses.
"""
containerName: "str | None" = None
"""
The name of the container.
"""
imageDigest: "str | None" = None
"""
The container image digest.
"""
image: "str | None" = None
"""
The container image.
"""
[docs]class DaemonRevision(ReadonlyPrimaryBoto3Model):
"""
Information about a daemon revision.
A daemon revision is a snapshot of the daemon's configuration at the time a
deployment was initiated.
"""
manager_class: ClassVar[type[Boto3ModelManager]] = DaemonRevisionManager
daemonRevisionArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the daemon revision.
"""
clusterArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the cluster that hosts the daemon.
"""
daemonArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the daemon for this revision.
"""
daemonTaskDefinitionArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the daemon task definition used by this revision.
"""
createdAt: "datetime | None" = None
"""
The Unix timestamp for the time when the daemon revision was created.
"""
containerImages: "builtins.list[DaemonContainerImage] | None" = Field(
default_factory=list
)
"""
The container images used by the daemon revision.
"""
propagateTags: "Literal['DAEMON', 'NONE'] | None" = None
"""
Specifies whether tags are propagated from the daemon to the daemon tasks.
"""
enableECSManagedTags: "bool | None" = None
"""
Specifies whether Amazon ECS managed tags are turned on for the daemon tasks.
"""
enableExecuteCommand: "bool | None" = None
"""
Specifies whether the execute command functionality is turned on for the daemon
tasks.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`daemonRevisionArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.daemonRevisionArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the
:py:attr:`daemonRevisionArn` attribute.
Returns:
The ARN of the model instance.
"""
return self.daemonRevisionArn
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`daemonRevisionArn` attribute.
"""
return hash(self.daemonRevisionArn)
@cached_property
def daemon(self) -> "Daemon | None":
"""
Return the :py:class:`Daemon` object for this daemon revision, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"daemonArn": self.daemonArn,
}
)
except AttributeError:
return None
return Daemon.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def cluster(self) -> "Cluster | None":
"""
Return the :py:class:`Cluster` object for this daemon revision, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return Cluster.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def daemon_task_definition(self) -> "DaemonTaskDefinition | None":
"""
Return the :py:class:`DaemonTaskDefinition` object for this daemon revision, if
any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"daemonTaskDefinition": self.daemonTaskDefinitionArn,
}
)
except AttributeError:
return None
return DaemonTaskDefinition.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs]class DaemonDeployment(ReadonlyPrimaryBoto3Model):
"""
A summary of a daemon deployment.
"""
manager_class: ClassVar[type[Boto3ModelManager]] = DaemonDeploymentManager
daemonDeploymentArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the daemon deployment.
"""
daemonArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the daemon.
"""
clusterArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the cluster that hosts the daemon.
"""
status: "Literal['PENDING', 'SUCCESSFUL', 'STOPPED', 'STOP_REQUESTED', 'IN_PROGRESS', 'ROLLBACK_IN_PROGRESS', 'ROLLBACK_SUCCESSFUL', 'ROLLBACK_FAILED'] | None" = None
"""
The status of the daemon deployment.
"""
statusReason: "str | None" = None
"""
Information about why the daemon deployment is in the current status.
"""
targetDaemonRevisionArn: "str | None" = None
"""
The ARN of the daemon revision being deployed.
"""
createdAt: "datetime | None" = None
"""
The time the daemon deployment was created.
"""
startedAt: "datetime | None" = None
"""
The time the daemon deployment started.
"""
stoppedAt: "datetime | None" = None
"""
The time the daemon deployment stopped.
"""
finishedAt: "datetime | None" = None
"""
The time the daemon deployment finished.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`daemonDeploymentArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.daemonDeploymentArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the
:py:attr:`daemonDeploymentArn` attribute.
Returns:
The ARN of the model instance.
"""
return self.daemonDeploymentArn
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`daemonDeploymentArn` attribute.
"""
return hash(self.daemonDeploymentArn)
@cached_property
def daemon(self) -> "Daemon | None":
"""
Return the :py:class:`Daemon` object that owns this deployment, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"daemonArn": self.daemonArn,
}
)
except AttributeError:
return None
return Daemon.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def cluster(self) -> "Cluster | None":
"""
Return the :py:class:`Cluster` object that owns this daemon deployment, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return Cluster.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def target_revision(self) -> "DaemonRevision | None":
"""
Return the target :py:class:`DaemonRevision` object for this daemon deployment,
if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"daemonRevisionArn": self.targetDaemonRevisionArn,
}
)
except AttributeError:
return None
return DaemonRevision.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs]class ExpressGatewayServiceStatus(Boto3Model):
"""
An object that defines the status of Express service creation and information about
the status of the service.
"""
statusCode: "Literal['ACTIVE', 'DRAINING', 'INACTIVE'] | None" = None
"""
The status of the Express service.
"""
statusReason: "str | None" = None
"""
Information about why the Express service is in the current status.
"""
[docs]class ExpressGatewayServiceNetworkConfiguration(Boto3Model):
"""
The network configuration for an Express service.
By default, an Express service utilizes subnets and security groups associated with
the default VPC.
"""
securityGroups: "builtins.list[str] | None" = Field(default_factory=list)
"""
The IDs of the security groups associated with the Express service.
"""
subnets: "builtins.list[str] | None" = Field(default_factory=list)
"""
The IDs of the subnets associated with the Express service.
"""
[docs]class ExpressGatewayServiceAwsLogsConfiguration(Boto3Model):
"""
Specifies the Amazon CloudWatch Logs configuration for the Express service
container.
"""
logGroup: str
"""
The name of the CloudWatch Logs log group to send container logs to.
"""
logStreamPrefix: str
"""
The prefix for the CloudWatch Logs log stream names.
The default for an Express service is ``ecs``.
"""
[docs]class ExpressGatewayRepositoryCredentials(Boto3Model):
"""
The repository credentials for private registry authentication to pass to the
container.
"""
credentialsParameter: "str | None" = None
"""
The Amazon Resource Name (ARN) of the secret containing the private repository
credentials.
"""
[docs]class ExpressGatewayContainer(Boto3Model):
"""
Defines the configuration for the primary container in an Express service. This
container receives traffic from the Application Load Balancer and runs your
application code.
The container configuration includes the container image, port mapping, logging
settings, environment variables, and secrets. The container image is the only
required parameter, with sensible defaults provided for other settings.
"""
image: str
"""
The image used to start a container.
This string is passed directly to the Docker daemon. Images in the Docker Hub
registry are available by default. Other repositories are specified with either ``repository-url/image:tag`` or
``repository-url/image@digest``.
"""
containerPort: "int | None" = None
"""
The port number on the container that receives traffic from the load balancer.
Default is 80.
"""
awsLogsConfiguration: "ExpressGatewayServiceAwsLogsConfiguration | None" = None
"""
The log configuration for the container.
"""
repositoryCredentials: "ExpressGatewayRepositoryCredentials | None" = None
"""
The configuration for repository credentials for private registry authentication.
"""
command: "builtins.list[str] | None" = Field(default_factory=list)
"""
The command that is passed to the container.
"""
environment: "builtins.list[KeyValuePair] | None" = Field(default_factory=list)
"""
The environment variables to pass to the container.
"""
secrets: "builtins.list[ECSContainerDefinitionSecret] | None" = Field(
default_factory=list
)
"""
The secrets to pass to the container.
"""
[docs]class ExpressGatewayScalingTarget(Boto3Model):
"""
Defines the auto-scaling configuration for an Express service. This determines how
the service automatically adjusts the number of running tasks based on demand
metrics such as CPU utilization, memory utilization, or request count per target.
Auto-scaling helps ensure your application can handle varying levels of traffic
while optimizing costs by scaling down during low-demand periods. You can specify
the minimum and maximum number of tasks, the scaling metric, and the target value
for that metric.
"""
minTaskCount: "int | None" = None
"""
The minimum number of tasks to run in the Express service.
"""
maxTaskCount: "int | None" = None
"""
The maximum number of tasks to run in the Express service.
"""
autoScalingMetric: "Literal['AVERAGE_CPU', 'AVERAGE_MEMORY', 'REQUEST_COUNT_PER_TARGET'] | None" = None
"""
The metric used for auto-scaling decisions.
The default metric used for an Express service is ``CPUUtilization``.
"""
autoScalingTargetValue: "int | None" = None
"""
The target value for the auto-scaling metric.
The default value for an Express service is 60.
"""
[docs]class IngressPathSummary(Boto3Model):
"""
The entry point into an Express service.
"""
accessType: Literal["PUBLIC", "PRIVATE"]
"""
The type of access to the endpoint for the Express service.
"""
endpoint: str
"""
The endpoint for access to the service.
"""
[docs]class ExpressGatewayServiceConfiguration(Boto3Model):
"""
Represents a specific configuration revision of an Express service, containing all
the settings and parameters for that revision.
"""
serviceRevisionArn: "str | None" = None
"""
The ARN of the service revision.
"""
executionRoleArn: "str | None" = None
"""
The ARN of the task execution role for the service revision.
"""
taskRoleArn: "str | None" = None
"""
The ARN of the task role for the service revision.
"""
cpu: "str | None" = None
"""
The CPU allocation for tasks in this service revision.
"""
memory: "str | None" = None
"""
The memory allocation for tasks in this service revision.
"""
networkConfiguration: "ExpressGatewayServiceNetworkConfiguration | None" = None
"""
The network configuration for tasks in this service revision.
"""
healthCheckPath: "str | None" = None
"""
The health check path for this service revision.
"""
primaryContainer: "ExpressGatewayContainer | None" = None
"""
The primary container configuration for this service revision.
"""
scalingTarget: "ExpressGatewayScalingTarget | None" = None
"""
The auto-scaling configuration for this service revision.
"""
ingressPaths: "builtins.list[IngressPathSummary] | None" = Field(
default_factory=list
)
"""
The entry point into this service revision.
"""
createdAt: "datetime | None" = None
"""
The Unix timestamp for when this service revision was created.
"""
[docs]class ExpressGatewayService(TagsDictMixin, PrimaryBoto3Model):
"""
Represents an Express service, which provides a simplified way to deploy
containerized web applications on Amazon ECS with managed Amazon Web Services
infrastructure. An Express service automatically provisions and manages Application
Load Balancers, target groups, security groups, and auto-scaling policies.
Express services use a service revision architecture where each service can have
multiple active configurations, enabling blue-green deployments and gradual
rollouts. The service maintains a list of active configurations and manages the
lifecycle of the underlying Amazon Web Services resources.
"""
tag_class: ClassVar[type[Boto3Model]] = ECSTag
manager_class: ClassVar[type[Boto3ModelManager]] = ExpressGatewayServiceManager
clusterArn: str = Field(default=None, alias="cluster")
"""
The short name or full ARN of the cluster that hosts the Express service.
"""
Tags: "builtins.list[ECSTag]" = Field(default_factory=list, alias="tags")
"""
The metadata applied to the Express service.
"""
serviceName: "str | None" = None
"""
The name of the Express service.
"""
serviceArn: "str | None" = None
"""
The ARN that identifies the Express service.
"""
infrastructureRoleArn: "str | None" = None
"""
The ARN of the infrastructure role that manages Amazon Web Services resources for
the Express service.
"""
status: ExpressGatewayServiceStatus = Field(default=None, frozen=True)
"""
The current status of the Express service.
"""
currentDeployment: str = Field(default=None, frozen=True)
"""
The current deployment configuration for the Express service.
"""
activeConfigurations: "builtins.list[ExpressGatewayServiceConfiguration]" = Field(
default_factory=list, frozen=True
)
"""
The list of active service configurations for the Express service.
"""
createdAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for when the Express service was created.
"""
updatedAt: datetime = Field(default=None, frozen=True)
"""
The Unix timestamp for when the Express service was last updated.
"""
executionRoleArn: str | None = None
"""
The execution role ARN to use for this Express gateway service.
"""
taskRoleArn: str | None = None
"""
The task role ARN to use for this Express gateway service.
"""
healthCheckPath: str | None = None
"""
The health check path to use for this Express gateway service.
"""
primaryContainer: ExpressGatewayContainer | None = None
"""
The primary container configuration for this Express gateway service.
"""
networkConfiguration: ExpressGatewayServiceNetworkConfiguration | None = None
"""
The network configuration for this Express gateway service.
"""
cpu: str | None = None
"""
The CPU units for this Express gateway service.
"""
memory: str | None = None
"""
The memory setting for this Express gateway service.
"""
scalingTarget: ExpressGatewayScalingTarget | None = None
"""
The autoscaling target configuration for this Express gateway service.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`serviceArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.serviceArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`serviceArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.serviceArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`serviceName`
attribute.
Returns:
The name of the model instance.
"""
return self.serviceName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`serviceArn` attribute.
"""
return hash(self.serviceArn)
@cached_property
def cluster(self) -> "Cluster | None":
"""
Return the :py:class:`Cluster` object that owns this Express gateway service, if
any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return Cluster.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def service(self) -> "Service | None":
"""
Return the backing :py:class:`Service` object for this Express gateway service,
if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"service": self.serviceArn,
"cluster": self.clusterArn,
}
)
except AttributeError:
return None
return Service.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def active_service_revisions(self) -> "list[ServiceRevision] | None":
"""
Return the active :py:class:`ServiceRevision` objects for this Express gateway
service, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"serviceRevisionArns": [
config.serviceRevisionArn
for config in self.activeConfigurations
if config.serviceRevisionArn
],
}
)
except AttributeError:
return []
return ServiceRevision.objects.using(self.session).list(**pk) # type: ignore[arg-type]
# =======================
# Request/Response Models
# =======================
[docs]class CreateManagedInstancesProviderConfiguration(Boto3Model):
"""
The configuration for creating a Amazon ECS Managed Instances provider.
This specifies how Amazon ECS should manage Amazon EC2 instances, including the
infrastructure role, instance launch template, and whether to propagate tags from
the capacity provider to the instances.
"""
infrastructureRoleArn: str
"""
The Amazon Resource Name (ARN) of the infrastructure role that Amazon ECS uses to
manage instances on your behalf.
This role must have permissions to launch, terminate, and manage Amazon EC2
instances, as well as access to other Amazon Web Services services required for
Amazon ECS Managed Instances functionality.
"""
instanceLaunchTemplate: InstanceLaunchTemplate
"""
The launch template configuration that specifies how Amazon ECS should launch Amazon
EC2 instances.
This includes the instance profile, network configuration, storage settings, and
instance requirements for attribute-based instance type selection.
"""
propagateTags: "Literal['CAPACITY_PROVIDER', 'NONE'] | None" = None
"""
Specifies whether to propagate tags from the capacity provider to the Amazon ECS
Managed Instances.
When enabled, tags applied to the capacity provider are automatically applied to all
instances launched by this provider.
"""
infrastructureOptimization: "InfrastructureOptimization | None" = None
"""
Defines how Amazon ECS Managed Instances optimizes the infrastastructure in your
capacity provider.
Provides control over the delay between when EC2 instances become idle or
underutilized and when Amazon ECS optimizes them.
"""
autoRepairConfiguration: "AutoRepairConfiguration | None" = None
"""
The auto repair configuration for the Amazon ECS Managed Instances capacity
provider.
Use this to enable or disable automatic replacement of container instances that are
detected as unhealthy.
"""
[docs]class CreateCapacityProviderResponse(Boto3Model):
capacityProvider: "CapacityProvider | None" = None
"""
The full description of the new capacity provider.
"""
[docs]class Failure(Boto3Model):
"""
A failed resource.
For a list of common causes, see
`API failure reasons <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/api_failures_messages.html>`_
in the *Amazon Elastic
Container Service Developer Guide*.
"""
arn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the failed resource.
"""
reason: "str | None" = None
"""
The reason for the failure.
"""
detail: "str | None" = None
"""
The details of the failure.
"""
[docs]class DescribeCapacityProvidersResponse(Boto3Model):
capacityProviders: "builtins.list[CapacityProvider] | None" = Field(
default_factory=list
)
"""
The list of capacity providers.
"""
failures: "builtins.list[Failure] | None" = Field(default_factory=list)
"""
Any failures associated with the call.
"""
nextToken: "str | None" = None
"""
The ``nextToken`` value to include in a future ``DescribeCapacityProviders``
request.
When the results of a
``DescribeCapacityProviders`` request exceed ``maxResults``, this value can be used to retrieve the next page of
results. This value is ``null`` when there are no more results to return.
"""
[docs]class AutoScalingGroupProviderUpdate(Boto3Model):
"""
The details of the Auto Scaling group capacity provider to update.
"""
managedScaling: "ManagedScaling | None" = None
"""
The managed scaling settings for the Auto Scaling group capacity provider.
"""
managedTerminationProtection: "Literal['ENABLED', 'DISABLED'] | None" = None
"""
The managed termination protection setting to use for the Auto Scaling group
capacity provider.
This determines whether the Auto Scaling group has managed termination protection.
"""
managedDraining: "Literal['ENABLED', 'DISABLED'] | None" = None
"""
The managed draining option for the Auto Scaling group capacity provider.
When you enable this, Amazon ECS manages and gracefully drains the EC2 container
instances that are in the Auto Scaling group capacity provider.
"""
[docs]class InstanceLaunchTemplateUpdate(Boto3Model):
"""
The updated launch template configuration for Amazon ECS Managed Instances. You can
modify the instance profile, network configuration, storage settings, and instance
requirements. Changes apply to new instances launched after the update.
For more information, see
`Store instance launch parameters in Amazon EC2 launch templates <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html>`_
in the *Amazon EC2 User
Guide*.
"""
ec2InstanceProfileArn: "str | None" = None
"""
The updated Amazon Resource Name (ARN) of the instance profile.
The new instance profile must have the necessary permissions for your tasks.
"""
networkConfiguration: "ManagedInstancesNetworkConfiguration | None" = None
"""
The updated network configuration for Amazon ECS Managed Instances.
Changes to subnets and security groups affect new instances launched after the
update.
"""
storageConfiguration: "ManagedInstancesStorageConfiguration | None" = None
"""
The updated storage configuration for Amazon ECS Managed Instances.
Changes to storage settings apply to new instances launched after the update.
"""
instanceMetadataTagsPropagation: "bool | None" = None
"""
Determines whether tags are propagated to the instance metadata service (IMDS) for
Amazon EC2 instances launched by the Managed Instances capacity provider.
When enabled, all tags associated with the instance are available through the
instance metadata service. When disabled, tags are not propagated to IMDS.
"""
localStorageConfiguration: "ManagedInstancesLocalStorageConfiguration | None" = None
"""
The updated local storage configuration for Amazon ECS Managed Instances.
Changes to local storage settings apply to new instances launched after the update.
"""
monitoring: "Literal['BASIC', 'DETAILED'] | None" = None
"""
CloudWatch provides two categories of monitoring: basic monitoring and detailed monitoring. By default, your managed
instance is configured for basic monitoring. You can optionally enable detailed monitoring to help you more quickly
identify and act on operational issues. You can enable or turn off detailed monitoring at launch or when the managed
instance is running or stopped. For more information, see `Detailed monitoring for Amazon ECS Managed
Instances <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/detailed-monitoring-managed-instances.html>`_ in
the Amazon ECS Developer Guide.
"""
instanceRequirements: "ECSInstanceRequirementsRequest | None" = None
"""
The updated instance requirements for attribute-based instance type selection.
Changes to instance requirements affect which instance types Amazon ECS selects for
new instances.
"""
capacityReservations: "CapacityReservationRequest | None" = None
"""
The updated capacity reservations specifications for Amazon ECS Managed Instances.
Changes to capacity reservations settings apply to new instances launched after the
update.
"""
[docs]class UpdateManagedInstancesProviderConfiguration(Boto3Model):
"""
The updated configuration for a Amazon ECS Managed Instances provider.
You can modify the infrastructure role, instance launch template, and tag
propagation settings. Changes apply to new instances launched after the update.
"""
infrastructureRoleArn: str
"""
The updated Amazon Resource Name (ARN) of the infrastructure role.
The new role must have the necessary permissions to manage instances and access
required Amazon Web Services services.
"""
instanceLaunchTemplate: InstanceLaunchTemplateUpdate
"""
The updated launch template configuration.
Changes to the launch template affect new instances launched after the update, while
existing instances continue to use their original configuration.
"""
propagateTags: "Literal['CAPACITY_PROVIDER', 'NONE'] | None" = None
"""
The updated tag propagation setting.
When changed, this affects only new instances launched after the update.
"""
infrastructureOptimization: "InfrastructureOptimization | None" = None
"""
The updated infrastructure optimization configuration.
Changes to this setting affect how Amazon ECS optimizes instances going forward.
"""
autoRepairConfiguration: "AutoRepairConfiguration | None" = None
"""
The updated auto repair configuration for the Amazon ECS Managed Instances capacity
provider.
"""
[docs]class UpdateCapacityProviderResponse(Boto3Model):
capacityProvider: "CapacityProvider | None" = None
"""
Details about the capacity provider.
"""
[docs]class DeleteCapacityProviderResponse(Boto3Model):
capacityProvider: "CapacityProvider | None" = None
"""
The details of the capacity provider.
"""
[docs]class CreateServiceResponse(Boto3Model):
service: "Service | None" = None
"""
The full description of your service following the create call.
"""
[docs]class DeleteServiceResponse(Boto3Model):
service: "Service | None" = None
"""
The full description of the deleted service.
"""
[docs]class DescribeServicesResponse(Boto3Model):
services: "builtins.list[Service] | None" = Field(default_factory=list)
"""
The list of services described.
"""
failures: "builtins.list[Failure] | None" = Field(default_factory=list)
"""
Any failures associated with the call.
"""
[docs]class ListServicesResponse(Boto3Model):
serviceArns: "builtins.list[str] | None" = Field(default_factory=list)
"""
The list of full ARN entries for each service that's associated with the specified
cluster.
"""
nextToken: "str | None" = None
"""
The ``nextToken`` value to include in a future ``ListServices`` request.
When the results of a ``ListServices`` request
exceed ``maxResults``, this value can be used to retrieve the next page of results. This value is ``null`` when there
are no more results to return.
"""
[docs]class UpdateServiceResponse(Boto3Model):
service: "Service | None" = None
"""
The full description of your service following the update call.
"""
[docs]class ClusterServiceConnectDefaultsRequest(Boto3Model):
"""
Use this parameter to set a default Service Connect namespace. After you set a
default Service Connect namespace, any new services with Service Connect turned on
that are created in the cluster are added as client services in the namespace. This
setting only applies to new services that set the ``enabled`` parameter to ``true``
in the ``ServiceConnectConfiguration``. You can set the namespace of each service
individually in the ``ServiceConnectConfiguration`` to override this default
parameter.
Tasks that run in a namespace can use short names to connect to services in the
namespace. Tasks can connect to services across all of the clusters in the
namespace. Tasks connect through a managed proxy container that collects logs and
metrics for increased visibility. Only the tasks that Amazon ECS services create are
supported with Service Connect. For more information, see
`Service Connect <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-
connect.html>`_ in the *Amazon Elastic Container Service Developer Guide*.
"""
namespace: str
"""
The namespace name or full Amazon Resource Name (ARN) of the Cloud Map namespace
that's used when you create a service and don't specify a Service Connect
configuration.
The namespace name can include up to 1024 characters. The name is case-sensitive.
The name can't include greater than (>), less than (<), double quotation marks ("),
or slash (/).
"""
[docs]class CreateClusterResponse(Boto3Model):
cluster: "Cluster | None" = None
"""
The full description of your new cluster.
"""
[docs]class DeleteClusterResponse(Boto3Model):
cluster: "Cluster | None" = None
"""
The full description of the deleted cluster.
"""
[docs]class DescribeClustersResponse(Boto3Model):
clusters: "builtins.list[Cluster] | None" = Field(default_factory=list)
"""
The list of clusters.
"""
failures: "builtins.list[Failure] | None" = Field(default_factory=list)
"""
Any failures associated with the call.
"""
[docs]class ListClustersResponse(Boto3Model):
clusterArns: "builtins.list[str] | None" = Field(default_factory=list)
"""
The list of full Amazon Resource Name (ARN) entries for each cluster that's
associated with your account.
"""
nextToken: "str | None" = None
"""
The ``nextToken`` value to include in a future ``ListClusters`` request.
When the results of a ``ListClusters`` request
exceed ``maxResults``, this value can be used to retrieve the next page of results. This value is ``null`` when there
are no more results to return.
"""
[docs]class UpdateClusterResponse(Boto3Model):
cluster: "Cluster | None" = None
"""
Details about the cluster.
"""
[docs]class RegisterTaskDefinitionResponse(TagsDictMixin, Boto3Model):
tag_class: ClassVar[type[Boto3Model]] = ECSTag
Tags: "builtins.list[ECSTag]" = Field(default_factory=list, alias="tags")
"""
The list of tags associated with the task definition.
"""
taskDefinition: "TaskDefinition | None" = None
"""
The full description of the registered task definition.
"""
[docs]class DeleteTaskDefinitionsResponse(Boto3Model):
taskDefinitions: "builtins.list[TaskDefinition] | None" = Field(
default_factory=list
)
"""
The list of deleted task definitions.
"""
failures: "builtins.list[Failure] | None" = Field(default_factory=list)
"""
Any failures associated with the call.
"""
[docs]class DescribeTaskDefinitionResponse(TagsDictMixin, Boto3Model):
tag_class: ClassVar[type[Boto3Model]] = ECSTag
Tags: "builtins.list[ECSTag]" = Field(default_factory=list, alias="tags")
"""
The metadata that's applied to the task definition to help you categorize and
organize them.
Each tag consists of a key and an optional value. You define both.
"""
taskDefinition: "TaskDefinition | None" = None
"""
The full task definition description.
"""
[docs]class ListTaskDefinitionsResponse(Boto3Model):
taskDefinitionArns: "builtins.list[str] | None" = Field(default_factory=list)
"""
The list of task definition Amazon Resource Name (ARN) entries for the
``ListTaskDefinitions`` request.
"""
nextToken: "str | None" = None
"""
The ``nextToken`` value to include in a future ``ListTaskDefinitions`` request.
When the results of a
``ListTaskDefinitions`` request exceed ``maxResults``, this value can be used to retrieve the next page of results. This
value is ``null`` when there are no more results to return.
"""
[docs]class DeregisterTaskDefinitionResponse(Boto3Model):
taskDefinition: "TaskDefinition | None" = None
"""
The full description of the deregistered task.
"""
[docs]class ListTaskDefinitionFamiliesResponse(Boto3Model):
families: "builtins.list[str] | None" = Field(default_factory=list)
"""
The list of task definition family names that match the
``ListTaskDefinitionFamilies`` request.
"""
nextToken: "str | None" = None
"""
The ``nextToken`` value to include in a future ``ListTaskDefinitionFamilies``
request.
When the results of a
``ListTaskDefinitionFamilies`` request exceed ``maxResults``, this value can be used to retrieve the next page of
results. This value is ``null`` when there are no more results to return.
"""
[docs]class DescribeContainerInstancesResponse(Boto3Model):
containerInstances: "builtins.list[ContainerInstance] | None" = Field(
default_factory=list
)
"""
The list of container instances.
"""
failures: "builtins.list[Failure] | None" = Field(default_factory=list)
"""
Any failures associated with the call.
"""
[docs]class ListContainerInstancesResponse(Boto3Model):
containerInstanceArns: "builtins.list[str] | None" = Field(default_factory=list)
"""
The list of container instances with full ARN entries for each container instance
associated with the specified cluster.
"""
nextToken: "str | None" = None
"""
The ``nextToken`` value to include in a future ``ListContainerInstances`` request.
When the results of a
``ListContainerInstances`` request exceed ``maxResults``, this value can be used to retrieve the next page of results.
This value is ``null`` when there are no more results to return.
"""
[docs]class ListTasksResponse(Boto3Model):
taskArns: "builtins.list[str] | None" = Field(default_factory=list)
"""
The list of task ARN entries for the ``ListTasks`` request.
"""
nextToken: "str | None" = None
"""
The ``nextToken`` value to include in a future ``ListTasks`` request.
When the results of a ``ListTasks`` request exceed
``maxResults``, this value can be used to retrieve the next page of results. This value is ``null`` when there are no
more results to return.
"""
[docs]class DescribeTasksResponse(Boto3Model):
tasks: "builtins.list[Task] | None" = Field(default_factory=list)
"""
The list of tasks.
"""
failures: "builtins.list[Failure] | None" = Field(default_factory=list)
"""
Any failures associated with the call.
"""
[docs]class TaskManagedEBSVolumeTerminationPolicy(Boto3Model):
"""
The termination policy for the Amazon EBS volume when the task exits.
For more information, see
`Amazon ECS volume termination policy <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ebs-volumes.html#ebs-volume-types>`_.
"""
deleteOnTermination: bool
"""
Indicates whether the volume should be deleted on when the task stops.
If a value of ``true`` is specified, Amazon ECS
deletes the Amazon EBS volume on your behalf when the task goes into the ``STOPPED`` state. If no value is specified,
the default value is ``true`` is used. When set to ``false``, Amazon ECS leaves the volume in your account.
"""
[docs]class TaskManagedEBSVolumeConfiguration(Boto3Model):
"""
The configuration for the Amazon EBS volume that Amazon ECS creates and manages on
your behalf.
These settings are used to create each Amazon EBS volume, with one volume created
for each task.
"""
encrypted: "bool | None" = None
"""
Indicates whether the volume should be encrypted.
If you turn on Region-level Amazon EBS encryption by default but set
this value as ``false``, the setting is overridden and the volume is encrypted with the KMS key specified for Amazon EBS
encryption by default. This parameter maps 1:1 with the ``Encrypted`` parameter of the `CreateVolume
API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html>`_ in the *Amazon EC2 API Reference*.
"""
kmsKeyId: "str | None" = None
"""
The Amazon Resource Name (ARN) identifier of the Amazon Web Services Key Management
Service key to use for Amazon EBS encryption.
When a key is specified using this parameter, it overrides Amazon EBS default encryption or any KMS key that
you specified for cluster-level managed storage encryption. This parameter maps 1:1 with the ``KmsKeyId`` parameter of
the `CreateVolume API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html>`_ in the *Amazon EC2
API Reference*. For more information about encrypting Amazon EBS volumes attached to a task, see `Encrypt data stored in
Amazon EBS volumes attached to Amazon ECS tasks <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ebs-kms-
encryption.html>`_.
"""
volumeType: "str | None" = None
"""
The volume type.
This parameter maps 1:1 with the ``VolumeType`` parameter of the `CreateVolume
API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html>`_ in the *Amazon EC2 API Reference*.
For more information, see `Amazon EBS volume types <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-
types.html>`_ in the *Amazon EC2 User Guide*.
"""
sizeInGiB: "int | None" = None
"""
The size of the volume in GiB.
You must specify either a volume size or a snapshot ID. If you specify a snapshot ID, the
snapshot size is used for the volume size by default. You can optionally specify a volume size greater than or equal to
the snapshot size. This parameter maps 1:1 with the ``Size`` parameter of the `CreateVolume
API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html>`_ in the *Amazon EC2 API Reference*.
"""
snapshotId: "str | None" = None
"""
The snapshot that Amazon ECS uses to create the volume.
You must specify either a snapshot ID or a volume size. This
parameter maps 1:1 with the ``SnapshotId`` parameter of the `CreateVolume
API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html>`_ in the *Amazon EC2 API Reference*.
"""
volumeInitializationRate: "int | None" = None
"""
The rate, in MiB/s, at which data is fetched from a snapshot of an existing Amazon
EBS volume to create a new volume for attachment to the task.
This property can be specified only if you specify a ``snapshotId``. For more information, see
`Initialize Amazon EBS volumes <https://docs.aws.amazon.com/ebs/latest/userguide/initalize-volume.html>`_ in the *Amazon
EBS User Guide*.
"""
iops: "int | None" = None
"""
The number of I/O operations per second (IOPS).
For ``gp3``, ``io1``, and ``io2`` volumes, this represents the number of
IOPS that are provisioned for the volume. For ``gp2`` volumes, this represents the baseline performance of the volume
and the rate at which the volume accumulates I/O credits for bursting.
"""
throughput: "int | None" = None
"""
The throughput to provision for a volume, in MiB/s, with a maximum of 1,000 MiB/s.
This parameter maps 1:1 with the
``Throughput`` parameter of the `CreateVolume
API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html>`_ in the *Amazon EC2 API Reference*.
"""
tagSpecifications: "builtins.list[EBSTagSpecification] | None" = Field(
default_factory=list
)
"""
The tags to apply to the volume.
Amazon ECS applies service-managed tags by default. This parameter maps 1:1 with the
``TagSpecifications.N`` parameter of the `CreateVolume
API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html>`_ in the *Amazon EC2 API Reference*.
"""
roleArn: str
"""
The ARN of the IAM role to associate with this volume.
This is the Amazon ECS infrastructure IAM role that is used to
manage your Amazon Web Services infrastructure. We recommend using the Amazon ECS-managed
``AmazonECSInfrastructureRolePolicyForVolumes`` IAM policy with this role. For more information, see `Amazon ECS
infrastructure IAM role <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/infrastructure_IAM_role.html>`_ in
the *Amazon ECS Developer Guide*.
"""
terminationPolicy: "TaskManagedEBSVolumeTerminationPolicy | None" = None
"""
The termination policy for the volume when the task exits.
This provides a way to control whether Amazon ECS terminates the Amazon EBS volume
when the task stops.
"""
filesystemType: "Literal['ext3', 'ext4', 'xfs', 'ntfs'] | None" = None
"""
The Linux filesystem type for the volume.
For volumes created from a snapshot, you must specify the same filesystem type that
the volume was using when the snapshot was created. If there is a filesystem type
mismatch, the task will fail to start.
"""
[docs]class TaskVolumeConfiguration(Boto3Model):
"""
Configuration settings for the task volume that was ``configuredAtLaunch`` that
weren't set during ``RegisterTaskDef``.
"""
name: str
"""
The name of the volume.
This value must match the volume name from the ``Volume`` object in the task definition.
"""
managedEBSVolume: "TaskManagedEBSVolumeConfiguration | None" = None
"""
The configuration for the Amazon EBS volume that Amazon ECS creates and manages on
your behalf.
These settings are used to create each Amazon EBS volume, with one volume created
for each task. The Amazon EBS volumes are visible in your account in the Amazon EC2
console once they are created.
"""
[docs]class RunTaskResponse(Boto3Model):
tasks: "builtins.list[Task] | None" = Field(default_factory=list)
"""
A full description of the tasks that were run.
The tasks that were successfully placed on your cluster are described here.
"""
failures: "builtins.list[Failure] | None" = Field(default_factory=list)
"""
Any failures associated with the call.
"""
[docs]class StopTaskResponse(Boto3Model):
task: "Task | None" = None
"""
The task that was stopped.
"""
[docs]class CreateTaskSetResponse(Boto3Model):
taskSet: "TaskSet | None" = None
"""
Information about a set of Amazon ECS tasks in either an CodeDeploy or an
``EXTERNAL`` deployment.
A task set includes details such as the desired number of tasks, how many tasks are
running, and whether the task set serves production traffic.
"""
[docs]class DescribeTaskSetsResponse(Boto3Model):
taskSets: "builtins.list[TaskSet] | None" = Field(default_factory=list)
"""
The list of task sets described.
"""
failures: "builtins.list[Failure] | None" = Field(default_factory=list)
"""
Any failures associated with the call.
"""
[docs]class UpdateTaskSetResponse(Boto3Model):
taskSet: "TaskSet | None" = None
"""
Details about the task set.
"""
[docs]class DeleteTaskSetResponse(Boto3Model):
taskSet: "TaskSet | None" = None
"""
Details about the task set.
"""
[docs]class DescribeServiceDeploymentsResponse(Boto3Model):
serviceDeployments: "builtins.list[ServiceDeployment] | None" = Field(
default_factory=list
)
"""
The list of service deployments described.
"""
failures: "builtins.list[Failure] | None" = Field(default_factory=list)
"""
Any failures associated with the call.
"""
[docs]class CreatedAt(Boto3Model):
"""
The optional filter to narrow the ``ListServiceDeployment`` results.
If you do not specify a value, service deployments that were created before the
current time are included in the result.
"""
before: "datetime | None" = None
"""
Include service deployments in the result that were created before this time.
The format is yyyy-MM-dd HH:mm:ss.SSSSSS.
"""
after: "datetime | None" = None
"""
Include service deployments in the result that were created after this time.
The format is yyyy-MM-dd HH:mm:ss.SSSSSS.
"""
[docs]class ServiceDeploymentBrief(Boto3Model):
"""
The service deployment properties that are retured when you call
``ListServiceDeployments``.
This provides a high-level overview of the service deployment.
"""
serviceDeploymentArn: "str | None" = None
"""
The ARN of the service deployment.
"""
serviceArn: "str | None" = None
"""
The ARN of the service for this service deployment.
"""
clusterArn: "str | None" = None
"""
The ARN of the cluster that hosts the service.
"""
startedAt: "datetime | None" = None
"""
The time that the service deployment statred.
The format is yyyy-MM-dd HH:mm:ss.SSSSSS.
"""
createdAt: "datetime | None" = None
"""
The time that the service deployment was created.
The format is yyyy-MM-dd HH:mm:ss.SSSSSS.
"""
finishedAt: "datetime | None" = None
"""
The time that the service deployment completed.
The format is yyyy-MM-dd HH:mm:ss.SSSSSS.
"""
targetServiceRevisionArn: "str | None" = None
"""
The ARN of the service revision being deplyed.
"""
status: "Literal['PENDING', 'SUCCESSFUL', 'STOPPED', 'STOP_REQUESTED', 'IN_PROGRESS', 'ROLLBACK_REQUESTED', 'ROLLBACK_IN_PROGRESS', 'ROLLBACK_SUCCESSFUL', 'ROLLBACK_FAILED'] | None" = None
"""
The status of the service deployment.
"""
statusReason: "str | None" = None
"""
Information about why the service deployment is in the current status.
For example, the circuit breaker detected a deployment failure.
"""
[docs]class ListServiceDeploymentsResponse(Boto3Model):
serviceDeployments: "builtins.list[ServiceDeploymentBrief] | None" = Field(
default_factory=list
)
"""
An overview of the service deployment, including the following properties:
"""
nextToken: "str | None" = None
"""
The ``nextToken`` value to include in a future ``ListServiceDeployments`` request.
When the results of a
``ListServiceDeployments`` request exceed ``maxResults``, this value can be used to retrieve the next page of results.
This value is null when there are no more results to return.
"""
[docs]class StopServiceDeploymentResponse(Boto3Model):
serviceDeploymentArn: "str | None" = None
"""
The ARN of the stopped service deployment.
"""
[docs]class DescribeServiceRevisionsResponse(Boto3Model):
serviceRevisions: "builtins.list[ServiceRevision] | None" = Field(
default_factory=list
)
"""
The list of service revisions described.
"""
failures: "builtins.list[Failure] | None" = Field(default_factory=list)
"""
Any failures associated with the call.
"""
[docs]class DescribeDaemonResponse(Boto3Model):
daemon: "Daemon | None" = None
"""
The full description of the daemon, including the current revisions, deployment ARN,
cluster, and status information.
"""
[docs]class DescribeDaemonTaskDefinitionResponse(Boto3Model):
daemonTaskDefinition: "DaemonTaskDefinition | None" = None
"""
The full daemon task definition description.
"""
[docs]class DescribeDaemonRevisionsResponse(Boto3Model):
daemonRevisions: "builtins.list[DaemonRevision] | None" = Field(
default_factory=list
)
"""
The list of daemon revisions.
"""
failures: "builtins.list[Failure] | None" = Field(default_factory=list)
"""
Any failures associated with the call.
"""
[docs]class CreateExpressGatewayServiceResponse(Boto3Model):
service: "ExpressGatewayService | None" = None
"""
The full description of your Express service following the create operation.
"""
[docs]class DescribeExpressGatewayServiceResponse(Boto3Model):
service: "ExpressGatewayService | None" = None
"""
The full description of the described express service.
"""
[docs]class DeleteExpressGatewayServiceResponse(Boto3Model):
service: "ExpressGatewayService | None" = None
"""
The full description of the deleted express service.
"""