create_express_gateway_service
¶
create_express_gateway_service(
infrastructure_role_arn: String,
*,
config_overrides: Optional[ECSClientConfig] = None,
execution_role_arn: Optional[String] = None,
service_name: Optional[String] = None,
cluster: Optional[String] = None,
health_check_path: Optional[String] = None,
primary_container: Optional[ExpressGatewayContainer] = None,
task_role_arn: Optional[String] = None,
network_configuration: Optional[ExpressGatewayServiceNetworkConfiguration] = None,
cpu: Optional[String] = None,
memory: Optional[String] = None,
cpu_architecture: Optional[ExpressCpuArchitecture] = None,
scaling_target: Optional[ExpressGatewayScalingTarget] = None,
tags: Optional[Tags] = None,
task_definition_arn: Optional[String] = None,
) -> CreateExpressGatewayServiceResponse
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.
Specify a primary container configuration with your application image and basic settings. Amazon ECS creates the necessary Amazon Web Services resources for traffic distribution, health monitoring, network access control, and capacity management.
Provide an execution role for task operations and an infrastructure role for managing Amazon Web Services resources on your behalf.
Parameters:
-
execution_role_arn(Optional[String], default: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. 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.
The execution role must include the
AmazonECSTaskExecutionRolePolicymanaged policy or equivalent permissions. For Express services, this role is used during task startup and runtime for container management operations. -
infrastructure_role_arn(String) –The Amazon Resource Name (ARN) of the infrastructure role that grants Amazon ECS permission to create and manage Amazon Web Services resources on your behalf for the Express service. This role is used to provision and manage Application Load Balancers, target groups, security groups, auto-scaling policies, and other Amazon Web Services infrastructure components.
The infrastructure role must include permissions for Elastic Load Balancing, Application Auto Scaling, Amazon EC2 (for security groups), and other services required for managed infrastructure. This role is only used during Express service creation, updates, and deletion operations.
-
service_name(Optional[String], default:None) –The name of the Express service. This name must be unique within the specified cluster and can contain up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens. The name is used to identify the service in the Amazon ECS console and API operations.
If you don't specify a service name, Amazon ECS generates a unique name for the service. The service name becomes part of the service ARN and cannot be changed after the service is created.
-
cluster(Optional[String], default:None) –The short name or full Amazon Resource Name (ARN) of the cluster on which to create the Express service. If you do not specify a cluster, the
defaultcluster is assumed. -
health_check_path(Optional[String], default:None) –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.
If not specified, the default health check path is
/ping. The health check path must start with a forward slash and can include query parameters. Examples:/health,/api/status,/ping?format=json. -
primary_container(Optional[ExpressGatewayContainer], default:None) –The primary container configuration for the Express service. This defines the main application container that will receive traffic from the Application Load Balancer.
The primary container must specify at minimum a container image. You can also configure the container port (defaults to 80), logging configuration, environment variables, secrets, and startup commands. The container image can be from Amazon ECR, Docker Hub, or any other container registry accessible to your execution role.
-
task_role_arn(Optional[String], default:None) –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.
The task role is different from the execution role. While the execution role is used by the Amazon ECS agent to set up the task, the task role is used by your application code running inside the container to make Amazon Web Services API calls. If your application doesn't need to access Amazon Web Services services, you can omit this parameter.
-
network_configuration(Optional[ExpressGatewayServiceNetworkConfiguration], default:None) –The network configuration for the Express service tasks. This specifies the VPC subnets and security groups for the tasks.
For Express services, you can specify custom security groups and subnets. If not provided, Amazon ECS will use the default VPC configuration and create appropriate security groups automatically. The network configuration determines how your service integrates with your VPC and what network access it has.
-
cpu(Optional[String], default:None) –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(Optional[String], default:None) –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.
-
cpu_architecture(Optional[ExpressCpuArchitecture], default:None) –The CPU architecture that the task runs on. If you don't specify a value, the default is
X86_64.Valid values:
-
X86_64- The x86 64-bit architecture. -
ARM64- The 64-bit ARM architecture.
Ensure that the container image you specify supports the architecture you choose. The operating system family for an Express service is always
LINUX.You can't specify
cpuArchitecturetogether withtaskDefinitionArn. -
-
scaling_target(Optional[ExpressGatewayScalingTarget], default:None) –The auto-scaling configuration for the Express service. This defines how the service automatically adjusts the number of running tasks based on demand.
You can specify the minimum and maximum number of tasks, the scaling metric (CPU utilization, memory utilization, or request count per target), and the target value for the metric. If not specified, the default target value for an Express service is 60.
-
tags(Optional[Tags], default:None) –The metadata that you apply to the Express service to help categorize and organize it. Each tag consists of a key and an optional value. You can apply up to 50 tags to a service.
-
task_definition_arn(Optional[String], default:None) –The Amazon Resource Name (ARN) of a task definition to use to create the Express Gateway service. This allows you to manage your own task definition, giving you more control over the service configuration such as adding sidecar containers.
The task definition must have a container named
Mainwith a single TCP port mapping that includes a container port and port name. The task definition must also haveFARGATEcompatibility.If you provide a task definition ARN, you cannot also specify
primaryContainer,executionRoleArn,taskRoleArn,cpu,memory, orcpuArchitecture.
Raises:
-
AccessDeniedException–You don't have authorization to perform the requested action.
-
ClientException–These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.
-
ClusterNotFoundException–The specified cluster wasn't found. You can view your available clusters with ListClusters. Amazon ECS clusters are Region specific.
-
InvalidParameterException–The specified parameter isn't valid. Review the available parameters for the API request.
For more information about service event errors, see Amazon ECS service event messages.
-
PlatformTaskDefinitionIncompatibilityException–The specified platform version doesn't satisfy the required capabilities of the task definition.
-
PlatformUnknownException–The specified platform version doesn't exist.
-
ServerException–These errors are usually caused by a server issue.
-
UnsupportedFeatureException–The specified task isn't supported in this Region.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_ecs/_services/ecs.py
4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 | |