Skip to content

Commit

Permalink
Update ecs_construct.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SavvasDobsonDunavant committed Feb 11, 2025
1 parent dd9bdb6 commit b639dbd
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/custom_constructs/ecs_construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,38 @@ def __init__(
container_insights=True
)

# Create initial task definitions with placeholder image
main_task_def = ecs.FargateTaskDefinition(
self,
"MainTaskDef",
memory_limit_mib=8192,
cpu=4096,
)
main_task_def.add_container(
"MainContainer",
image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample"),
port_mappings=[ecs.PortMapping(container_port=1337)]
)

jobs_task_def = ecs.FargateTaskDefinition(
self,
"JobsTaskDef",
memory_limit_mib=8192,
cpu=4096,
)
jobs_task_def.add_container(
"JobsContainer",
image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample"),
port_mappings=[ecs.PortMapping(container_port=1337)]
)

# Create main service
self._service = ecs.FargateService(
self,
"Service",
service_name=f"outlier-service-{self.environment}",
cluster=self._cluster,
task_definition=main_task_def, # Add this
desired_count=2,
security_groups=security_groups,
vpc_subnets=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PRIVATE_WITH_EGRESS),
Expand All @@ -47,6 +73,7 @@ def __init__(
"JobsService",
service_name=f"outlier-job-service-{self.environment}",
cluster=self._cluster,
task_definition=jobs_task_def, # Add this
desired_count=2,
security_groups=security_groups,
vpc_subnets=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PRIVATE_WITH_EGRESS),
Expand Down

0 comments on commit b639dbd

Please sign in to comment.