Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Fargate Spot tasks #7

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/service_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,17 @@ def _get_secret(scope: Construct, id: str, name: str) -> sm.Secret:
)
],
),
# Ensure at least one on demand task and the remaining should be spot tasks
capacity_provider_strategies=[
ecs.CapacityProviderStrategy(
capacity_provider="FARGATE",
base=1, # At least 1 task will be run by FARGATE
),
ecs.CapacityProviderStrategy(
capacity_provider="FARGATE_SPOT",
weight=1, # The remain task will be run by FARGATE_SPOT
),
],
)

# Setup AutoScaling policy
Expand Down
Loading