services.x-ecs ¶
services:
serviceA:
image: nginx/nginx
x-ecs:
CapacityProviderStrategy: [CapacityProviderStrategyItem]
EnableExecuteCommand: bool
CpuArchitecture: str
OperatingSystemFamily: str
CapacityProviderStrategy ¶
List of CapacityProviderStrategyItem that allows to define the CapacityProviders you wish to use for this service, that comes as an override of the Cluster defined default CapacityProviderStrategy.
Hint
When using x-cluster.Lookup, the cluster properties will be evaluated to identify what capacity providers are defined on the cluster.
When assigning the capacity provider to the services, ECS Compose-X will ensure (fail) that the Capacity Providers defined in x-ecs are present in the ECS Cluster.
If the cluster has no Capacity Provider defined, validation is skipped.
EnableExecuteCommand ¶
Allows to create the IAM permissions, and other settings, to use AWS ECS Execute Command. False by default. Currently only enabled when using Fargate, future version will enable it for ECS Anywhere.
CpuArchitecture ¶
Allows you to override the RuntimePlatform.CpuArchitecture property for the TaskDefinition.
Note
Only works for FARGATE. Must be unique for all tasks of the family.
OperatingSystemFamily ¶
Allows you to override the RuntimePlatform.OperatingSystemFamily property for the TaskDefinition.
Note
Only works for FARGATE. Must be unique for all tasks of the family.
Examples ¶
services:
grafana:
x-ecs:
CapacityProviderStrategy:
- CapacityProvider: FARGATE
Base: 1
Weight: 2
- CapacityProvider: FARGATE_SPOT
Base: 4
Weight: 8
services:
grafana:
deploy:
labels:
ecs.task.family: grafana
x-ecs:
CapacityProviderStrategy:
- CapacityProvider: FARGATE
Base: 1
Weight: 2
nginx:
deploy:
labels:
ecs.task.family: grafana
x-ecs:
CapacityProviderStrategy:
- CapacityProvider: FARGATE
Base: 0
Weight: 3
- CapacityProvider: FARGATE_SPOT
Base: 4
Weight: 8
In the above example, where grafana and nginx are part of the same task definition and therefore same ECS Service, we do the following:
-
If a capacity provider is set in only one service, we use it for both as-is
-
- If they both define properties for a same CapacityProvider, here, FARGATE, we take the maximum value of the set.
-
Here we take 1 for Base (from grafana) and 3 for Weight (from nginx).
Tip
You can find the test files here to use as reference for your use-case.
JSON Schema ¶
Model ¶
services.x-ecs specification ¶
services.x-ecs |
||||
The services.x-ecs specification for ComposeX |
||||
type |
object |
|||
properties |
||||
|
||||
type |
boolean |
|||
|
||||
type |
string |
|||
enum |
ARM64, X86_64 |
|||
|
||||
type |
string |
|||
enum |
LINUX, WINDOWS_SERVER_2004_CORE, WINDOWS_SERVER_2016_FULL, WINDOWS_SERVER_2019_CORE, WINDOWS_SERVER_2019_FULL, WINDOWS_SERVER_2022_CORE, WINDOWS_SERVER_2022_FULL, WINDOWS_SERVER_20H2_CORE |
|||
|
type |
array |
||
items |
||||
type |
object |
|||
properties |
||||
|
||||
type |
number |
|||
maximum |
100000 |
|||
minimum |
0 |
|||
default |
0 |
|||
|
||||
type |
number |
|||
maximum |
1000 |
|||
minimum |
0 |
|||
default |
0 |
|||
|
||||
type |
string |
|||
additionalProperties |
False |
Definition ¶
{
"$schema": "http://json-schema.org/draft-07/schema#",
"id": "services.x-ecs",
"$id": "services.x-ecs.spec.json",
"type": "object",
"title": "services.x-ecs specification",
"description": "The services.x-ecs specification for ComposeX",
"properties": {
"EnableExecuteCommand": {
"type": "boolean",
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-enableexecutecommand"
},
"CpuArchitecture": {
"type": "string",
"enum": [
"ARM64",
"X86_64"
],
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-runtimeplatform.html#cfn-ecs-taskdefinition-runtimeplatform-cpuarchitecture"
},
"OperatingSystemFamily": {
"type": "string",
"enum": [
"LINUX",
"WINDOWS_SERVER_2004_CORE",
"WINDOWS_SERVER_2016_FULL",
"WINDOWS_SERVER_2019_CORE",
"WINDOWS_SERVER_2019_FULL",
"WINDOWS_SERVER_2022_CORE",
"WINDOWS_SERVER_2022_FULL",
"WINDOWS_SERVER_20H2_CORE"
],
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-runtimeplatform.html#cfn-ecs-taskdefinition-runtimeplatform-operatingsystemfamily"
},
"CapacityProviderStrategy": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-capacityproviderstrategyitem.html",
"required": [
"CapacityProvider"
],
"properties": {
"Base": {
"type": "number",
"default": 0,
"minimum": 0,
"maximum": 100000,
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-capacityproviderstrategyitem.html#cfn-ecs-service-capacityproviderstrategyitem-base"
},
"Weight": {
"type": "number",
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-capacityproviderstrategyitem.html#cfn-ecs-service-capacityproviderstrategyitem-weight",
"default": 0,
"minimum": 0,
"maximum": 1000
},
"CapacityProvider": {
"type": "string",
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-capacityproviderstrategyitem.html#cfn-ecs-service-capacityproviderstrategyitem-capacityprovider"
}
}
}
}
}
}