Copyright (c) 2024, GitHub@programmingwithalex
Microservices on AWS with ECS Service Connect
View Demo
·
Report Bug
·
Request Feature
Table of Contents
-
Get microservices example running locally using
docker-compose
-
Create working example of microservices on AWS using ECS Service Connect
- will not be production ready
- will rely on a lot of default values provided by AWS, with no networking setup by us
-
Create production-ready example of microservices on AWS using ECS Service Connect
- configure networking setup and apply that to ECS components
-
Use GitHub Actions to automate deployments to AWS ECS components, referred to as Continuous Deployment (CD)
-
Create networking setup and ECS components automatically with a single script using AWS CDK
- Virtual Private Cloud (VPC)
- NAT Gateway & Internet Gateway (IGW)
- Elastic Container Registry (ECR)
- Elastic Container Service (ECS)
- ECS Clusters
- ECS Services
- ECS Task Definitions
- Cloud Map
- Application Load Balancer (ALB)
- AWS Cloud Development Kit (CDK)
- written in Python
- Python: version requirement determined by AWS CLI requirement and optionally AWS CDK requirement
- Docker Desktop: account not required, just installation
- create AWS IAM user account than can be configured with the AWS CLI
- follow setup guides for
aws-cli
if not already configured
npm install -g aws-cdk
cdk init app --language python
- create the initial CDK app locallycdk bootstrap
- deploying the AWS CDK for the first timecdk synth
- constucts CloudFormation template and does some verification checkscdk deploy --all
- deploy all CDK componentscdk destroy --all
- destroys all CDK components- issue with calling because of Fargate Cluster dependency -
FargateCluster/FargateCluster (...) Resource handler returned message: "The specified capacity provider is in use and cannot be removed.
- if called twice then all elements will be deleted
- issue with calling because of Fargate Cluster dependency -
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-application-load-balancer.html
If your service's task definition uses the awsvpc network mode (which is required for the Fargate launch type), you must choose IP addresses as the target type. This is because tasks that use the awsvpc network mode are associated with an elastic network interface, not an Amazon EC2 instance.
Protocol port will be overriden by ECS anwyays so doesn't matter.
Choose client and server service if the container exposes and listens on a port for network traffic. This service gets an endpoint to communicate with any service within the same namespace
Instructions on using the AWS Cloud Development Kit (CDK)