Skip to content

dfoley-fr/aws_cdk-ecs-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aws_cdk-ecs-service

A reusable AWS CDK module for deploying an ECS Service with advanced deployment and load balancing options.

Features

  • Deploys an ECS Service using CloudFormation via AWS CDK
  • Supports custom deployment configuration and circuit breaker
  • Integrates with existing ECS Cluster and Target Group via CloudFormation exports
  • Outputs ECS Service Name, ARN, and ID

Installation

pip install ecs_service

Usage

Prerequisites

  • Python 3.8+
  • AWS CDK v2
  • Install dependencies:
    pip install aws-cdk-lib constructs pytest
    

Example

from aws_cdk import App, Stack
from ecs_service.ecs_service_stack import ECSServiceStack

app = App()
stack = Stack(app, "MyStack")

ECSServiceStack(
    scope=stack,
    id="ECSService",
    ecs_stack_name="MyStack",
    desired_count=2,
    task_definition_arn="arn:aws:ecs:region:account-id:task-definition/my-task-def",
    health_check_grace_period_seconds=60,
    container_port=80,
    target_group_arn="arn:aws:elasticloadbalancing:region:account-id:targetgroup/my-tg/1234567890abcdef",
    containername="my-container",
    maximum_percent=200,
    minimum_healthy_percent=100
)

Testing

Unit tests are provided using pytest and aws_cdk.assertions.

To run tests:

pytest

Logical IDs

Logical IDs generated by AWS CDK are random and may change between synths. Use resource outputs and exports for stable references.

Project Structure

src/
  ecs_service/
    ecs_service_stack.py
tests/
  test_ecs_service.py
README.md

About

CDK Module for ecs service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages