SlideShare a Scribd company logo
Easy Nginx load balancing
across ECS services
Stefano Fratini
stefanofratini610
bitsandpieces.it
@fratuz610
Contents
2
Journey to containerization
The good the bad and the ugly
ECS
ECS vs K8S
Nginx and ECS playing nicely together
ECS Ingress
1
2
3
Containerization
3
SIMPLIFY
management and
create high availability
CI/CD
Seamless CI/CD
approach
COST EFFECTIVE
Because it's easy to
spend a motza on cloud
services
Containerization on K8S
4
COMPLEXITY
and overhead
DEDICATED RES
which we don't have
EXPENSIVE
At least on AWS
● It offers basic container orchestration capabilities
● Ideal for small clusters
● it integrates very well with AWS services
● it's very cheap to run
● It's a lock in solution but so is the whole AWS ecosystem
● we lose secrets, and configuration management from K8S
5
Amazon ECS
ECS Shortcomings
Documentation is lacking
Learning curve is still steep
Ingress networking (*LBs) is inflexible
yet quite expensive
*LB is just not Nginx
● too limiting in terms of routing and URL rewriting
● configuration is cumbersome via API calls
● nothing can beat the simplicity of the Nginx text based
configuration
Can we have it all?*
8
*spoiler alert: yes we can
The problem
9
A load balancing solution that
integrates natively with ECS but
is as easy to configure as Nginx?
The solution
10
ECS Ingress
● a small golang executable that
spawn a vanilla nginx instance
● loosely modelled after ingress-
nginx but 10x simpler :)
● leverages continuously updated
upstreams to integrate with ECS
services
● reads the Nginx conf
dynamically from in S3
github.com/fratuz610/ecs-ingress
Visually
AWS VPC
EC2 #3
EC2 #2
EC2 #1
ECS CLUSTER
SERVICE 1
SERVICE 2
SERVICE 2
incoming
HTTP / TCP
traffic
SERVICE 1
ECS INGRESS ECS INGRESS ECS INGRESS
NGINX
CONFIG
CLUSTER
CHANGES
app.example.com. ::
59 IN A <EC2-1-public-ip>
59 IN A <EC2-2-public-ip>
59 IN A <EC2-3-public-ip>
CD tool
Basic nginx config
http {
...
# all upstreams
# this is the dynamic reference that always needs to be there
include /app/nginx/upstreams.conf;
server {
server_name app.example.com;
location / {
# app-ui-prod should be the name of the ECS service
proxy_pass http://app-ui-prod;
}
location /v2/api {
# app-api-prod should be the name of the ECS service
proxy_pass http://app-api-prod;
}
}
}
Nginx config with HTTPS
http {
...
# all upstreams
# this is the dynamic reference that always needs to be there
include /app/nginx/upstreams.conf;
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /app/nginx/fullchain.pem;
ssl_certificate_key /app/nginx/privkey.pem;
...
location /v2/api {
# app-api-prod should be the name of the ECS service
proxy_pass http://app-api-prod;
}
}
}
Nginx with TCP tunnelling
stream {
# all upstreams
# this needs to be repeated here as it's context sensitive - http and stream
include /app/nginx/upstreams.conf;
server {
listen 1883 so_keepalive=on;
proxy_pass mqtt-server:1883;
proxy_connect_timeout 1s;
}
}
Nginx with TCP tunnelling #2
# PGSQL Connector to the postgres-prod upstream
stream {
# all upstreams
include /app/nginx/upstreams.conf;
server {
listen 5432 so_keepalive=on;
proxy_pass postgres-prod;
# allows access only from the current host
allow 172.17.0.0/16;
deny all;
}
}
You can connect to Pgsql on 172.17.0.1:5432 from each container in the cluster.
Gotchas
● A valid Nginx config is required to start the container
● Only ECS RUNNING tasks are considered
● ECS ingress combines NGINX logs and the golang ones*
● It uses polling (every 10 seconds).
API calls are free, S3 calls are metered.
*for easy ingestion into CloudWatch
Roadmap
● Notifications / Slack Hooks
● Polling improvements (S3)
● Automatic Route53/DNS updates
● Letsencrypt support
● Move to Openresty
Does anyone have any questions?
18
Thanks!
stefanofratini610
bitsandpieces.it
@fratuz610
github.com/fratuz610/ecs-ingress

More Related Content

What's hot

基于Aws的持续集成、交付和部署 代闻
基于Aws的持续集成、交付和部署 代闻基于Aws的持续集成、交付和部署 代闻
基于Aws的持续集成、交付和部署 代闻
Mason Mei
 

What's hot (20)

Dev/Test Environment Provisioning and Management on AWS
Dev/Test Environment Provisioning and Management on AWSDev/Test Environment Provisioning and Management on AWS
Dev/Test Environment Provisioning and Management on AWS
 
Amazon EKS Managed Kubernetes Cluster
Amazon EKS Managed Kubernetes ClusterAmazon EKS Managed Kubernetes Cluster
Amazon EKS Managed Kubernetes Cluster
 
IaC로 AWS인프라 관리하기 - 이진성 (AUSG) :: AWS Community Day Online 2021
IaC로 AWS인프라 관리하기 - 이진성 (AUSG) :: AWS Community Day Online 2021IaC로 AWS인프라 관리하기 - 이진성 (AUSG) :: AWS Community Day Online 2021
IaC로 AWS인프라 관리하기 - 이진성 (AUSG) :: AWS Community Day Online 2021
 
Deep Dive On Serverless App Development
Deep Dive On Serverless App DevelopmentDeep Dive On Serverless App Development
Deep Dive On Serverless App Development
 
[AWS Builders] 실 적용 사례로 알아보는, AWS를 활용한 WAF 보안의 장점 - 삼성SDS 천준호 프로, 컨설팅그룹 (보안기획팀)
[AWS Builders] 실 적용 사례로 알아보는, AWS를 활용한 WAF 보안의 장점 -  삼성SDS 천준호 프로, 컨설팅그룹 (보안기획팀)[AWS Builders] 실 적용 사례로 알아보는, AWS를 활용한 WAF 보안의 장점 -  삼성SDS 천준호 프로, 컨설팅그룹 (보안기획팀)
[AWS Builders] 실 적용 사례로 알아보는, AWS를 활용한 WAF 보안의 장점 - 삼성SDS 천준호 프로, 컨설팅그룹 (보안기획팀)
 
基于Aws的持续集成、交付和部署 代闻
基于Aws的持续集成、交付和部署 代闻基于Aws的持续集成、交付和部署 代闻
基于Aws的持续集成、交付和部署 代闻
 
Managing Your Infrastructure as Code by Travis Williams, Solutions Architect,...
Managing Your Infrastructure as Code by Travis Williams, Solutions Architect,...Managing Your Infrastructure as Code by Travis Williams, Solutions Architect,...
Managing Your Infrastructure as Code by Travis Williams, Solutions Architect,...
 
AWS Deployment Best Practices
AWS Deployment Best PracticesAWS Deployment Best Practices
AWS Deployment Best Practices
 
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWSAWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
 
AWS Workshop Series: Microsoft licensing and active directory on AWS
AWS Workshop Series: Microsoft licensing and active directory on AWSAWS Workshop Series: Microsoft licensing and active directory on AWS
AWS Workshop Series: Microsoft licensing and active directory on AWS
 
Aws container webinar day 2
Aws container webinar day 2Aws container webinar day 2
Aws container webinar day 2
 
Introduction to Amazon EC2
Introduction to Amazon EC2Introduction to Amazon EC2
Introduction to Amazon EC2
 
Advanced Task Scheduling with Amazon ECS
Advanced Task Scheduling with Amazon ECSAdvanced Task Scheduling with Amazon ECS
Advanced Task Scheduling with Amazon ECS
 
Architecting Microsoft Applications with VMware on AWS - WIN305 - re:Invent 2017
Architecting Microsoft Applications with VMware on AWS - WIN305 - re:Invent 2017Architecting Microsoft Applications with VMware on AWS - WIN305 - re:Invent 2017
Architecting Microsoft Applications with VMware on AWS - WIN305 - re:Invent 2017
 
Deep dive on Microservices and ECS - AWS Summit Tel Aviv 2017
Deep dive on Microservices and ECS - AWS Summit Tel Aviv 2017Deep dive on Microservices and ECS - AWS Summit Tel Aviv 2017
Deep dive on Microservices and ECS - AWS Summit Tel Aviv 2017
 
Well-Architected for Security: Advanced Session
Well-Architected for Security: Advanced SessionWell-Architected for Security: Advanced Session
Well-Architected for Security: Advanced Session
 
Hybris install telco accelerators on aws-ec2
Hybris   install telco accelerators on aws-ec2Hybris   install telco accelerators on aws-ec2
Hybris install telco accelerators on aws-ec2
 
AWS re:Invent 2016: Hybrid Architectures: Bridging the Gap to the Cloud( ARC2...
AWS re:Invent 2016: Hybrid Architectures: Bridging the Gap to the Cloud( ARC2...AWS re:Invent 2016: Hybrid Architectures: Bridging the Gap to the Cloud( ARC2...
AWS re:Invent 2016: Hybrid Architectures: Bridging the Gap to the Cloud( ARC2...
 
Secure Content Delivery with AWS
Secure Content Delivery with AWSSecure Content Delivery with AWS
Secure Content Delivery with AWS
 
(ENT303) Getting Started with AWS for VMware Professionals | AWS re:Invent 2014
(ENT303) Getting Started with AWS for VMware Professionals | AWS re:Invent 2014(ENT303) Getting Started with AWS for VMware Professionals | AWS re:Invent 2014
(ENT303) Getting Started with AWS for VMware Professionals | AWS re:Invent 2014
 

Similar to ECS-Ingress: easy nginx load balancing across ecs services

Similar to ECS-Ingress: easy nginx load balancing across ecs services (20)

Building and running Spring Cloud-based microservices on AWS ECS
Building and running Spring Cloud-based microservices on AWS ECSBuilding and running Spring Cloud-based microservices on AWS ECS
Building and running Spring Cloud-based microservices on AWS ECS
 
Lunar Way and the Cloud Native "stack"
Lunar Way and the Cloud Native "stack"Lunar Way and the Cloud Native "stack"
Lunar Way and the Cloud Native "stack"
 
Making Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixMaking Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch Fix
 
Dive into DevOps | March, Traefik as kubernetes ingress controller, Ihor Borodin
Dive into DevOps | March, Traefik as kubernetes ingress controller, Ihor BorodinDive into DevOps | March, Traefik as kubernetes ingress controller, Ihor Borodin
Dive into DevOps | March, Traefik as kubernetes ingress controller, Ihor Borodin
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Localize content Devops
Localize content DevopsLocalize content Devops
Localize content Devops
 
Max Körbächer - AWS EKS and beyond master your Kubernetes deployment on AWS -...
Max Körbächer - AWS EKS and beyond master your Kubernetes deployment on AWS -...Max Körbächer - AWS EKS and beyond master your Kubernetes deployment on AWS -...
Max Körbächer - AWS EKS and beyond master your Kubernetes deployment on AWS -...
 
Max Körbächer - AWS EKS and beyond – master your Kubernetes deployment on AWS...
Max Körbächer - AWS EKS and beyond – master your Kubernetes deployment on AWS...Max Körbächer - AWS EKS and beyond – master your Kubernetes deployment on AWS...
Max Körbächer - AWS EKS and beyond – master your Kubernetes deployment on AWS...
 
Bitbucket Pipelines - Powered by Kubernetes
Bitbucket Pipelines - Powered by KubernetesBitbucket Pipelines - Powered by Kubernetes
Bitbucket Pipelines - Powered by Kubernetes
 
Kubernetes Kops - Automation Night
Kubernetes Kops - Automation NightKubernetes Kops - Automation Night
Kubernetes Kops - Automation Night
 
Azure Service Fabric: The road ahead for microservices
Azure Service Fabric: The road ahead for microservicesAzure Service Fabric: The road ahead for microservices
Azure Service Fabric: The road ahead for microservices
 
Kubernetes basics and hands on exercise
Kubernetes basics and hands on exerciseKubernetes basics and hands on exercise
Kubernetes basics and hands on exercise
 
Aws + kubernetes = ❤︎
Aws + kubernetes = ❤︎Aws + kubernetes = ❤︎
Aws + kubernetes = ❤︎
 
Lessons learned migrating 100+ services to Kubernetes
Lessons learned migrating 100+ services to KubernetesLessons learned migrating 100+ services to Kubernetes
Lessons learned migrating 100+ services to Kubernetes
 
Effective Building your Platform with Kubernetes == Keep it Simple
Effective Building your Platform with Kubernetes == Keep it Simple Effective Building your Platform with Kubernetes == Keep it Simple
Effective Building your Platform with Kubernetes == Keep it Simple
 
Customer Sharing: miiiCasa - Deep Dive into AWS ECS and Spot Instances at Scale
Customer Sharing: miiiCasa - Deep Dive into AWS ECS and Spot Instances at ScaleCustomer Sharing: miiiCasa - Deep Dive into AWS ECS and Spot Instances at Scale
Customer Sharing: miiiCasa - Deep Dive into AWS ECS and Spot Instances at Scale
 
Deep Dive into AWS ECS and Spot Instances at Scale
Deep Dive into AWS ECS and Spot Instances at ScaleDeep Dive into AWS ECS and Spot Instances at Scale
Deep Dive into AWS ECS and Spot Instances at Scale
 
Metal-k8s presentation by Julien Girardin @ Paris Kubernetes Meetup
Metal-k8s presentation by Julien Girardin @ Paris Kubernetes MeetupMetal-k8s presentation by Julien Girardin @ Paris Kubernetes Meetup
Metal-k8s presentation by Julien Girardin @ Paris Kubernetes Meetup
 
Meetup 2023 - Gateway API.pdf
Meetup 2023 - Gateway API.pdfMeetup 2023 - Gateway API.pdf
Meetup 2023 - Gateway API.pdf
 
Introduction to Containers - AWS Startup Day Johannesburg.pdf
Introduction to Containers - AWS Startup Day Johannesburg.pdfIntroduction to Containers - AWS Startup Day Johannesburg.pdf
Introduction to Containers - AWS Startup Day Johannesburg.pdf
 

Recently uploaded

Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
mbmh111980
 

Recently uploaded (20)

Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 

ECS-Ingress: easy nginx load balancing across ecs services

  • 1. Easy Nginx load balancing across ECS services Stefano Fratini stefanofratini610 bitsandpieces.it @fratuz610
  • 2. Contents 2 Journey to containerization The good the bad and the ugly ECS ECS vs K8S Nginx and ECS playing nicely together ECS Ingress 1 2 3
  • 3. Containerization 3 SIMPLIFY management and create high availability CI/CD Seamless CI/CD approach COST EFFECTIVE Because it's easy to spend a motza on cloud services
  • 4. Containerization on K8S 4 COMPLEXITY and overhead DEDICATED RES which we don't have EXPENSIVE At least on AWS
  • 5. ● It offers basic container orchestration capabilities ● Ideal for small clusters ● it integrates very well with AWS services ● it's very cheap to run ● It's a lock in solution but so is the whole AWS ecosystem ● we lose secrets, and configuration management from K8S 5 Amazon ECS
  • 6. ECS Shortcomings Documentation is lacking Learning curve is still steep Ingress networking (*LBs) is inflexible yet quite expensive
  • 7. *LB is just not Nginx ● too limiting in terms of routing and URL rewriting ● configuration is cumbersome via API calls ● nothing can beat the simplicity of the Nginx text based configuration
  • 8. Can we have it all?* 8 *spoiler alert: yes we can
  • 9. The problem 9 A load balancing solution that integrates natively with ECS but is as easy to configure as Nginx?
  • 10. The solution 10 ECS Ingress ● a small golang executable that spawn a vanilla nginx instance ● loosely modelled after ingress- nginx but 10x simpler :) ● leverages continuously updated upstreams to integrate with ECS services ● reads the Nginx conf dynamically from in S3 github.com/fratuz610/ecs-ingress
  • 11. Visually AWS VPC EC2 #3 EC2 #2 EC2 #1 ECS CLUSTER SERVICE 1 SERVICE 2 SERVICE 2 incoming HTTP / TCP traffic SERVICE 1 ECS INGRESS ECS INGRESS ECS INGRESS NGINX CONFIG CLUSTER CHANGES app.example.com. :: 59 IN A <EC2-1-public-ip> 59 IN A <EC2-2-public-ip> 59 IN A <EC2-3-public-ip> CD tool
  • 12. Basic nginx config http { ... # all upstreams # this is the dynamic reference that always needs to be there include /app/nginx/upstreams.conf; server { server_name app.example.com; location / { # app-ui-prod should be the name of the ECS service proxy_pass http://app-ui-prod; } location /v2/api { # app-api-prod should be the name of the ECS service proxy_pass http://app-api-prod; } } }
  • 13. Nginx config with HTTPS http { ... # all upstreams # this is the dynamic reference that always needs to be there include /app/nginx/upstreams.conf; server { listen 443 ssl; listen [::]:443 ssl; ssl_certificate /app/nginx/fullchain.pem; ssl_certificate_key /app/nginx/privkey.pem; ... location /v2/api { # app-api-prod should be the name of the ECS service proxy_pass http://app-api-prod; } } }
  • 14. Nginx with TCP tunnelling stream { # all upstreams # this needs to be repeated here as it's context sensitive - http and stream include /app/nginx/upstreams.conf; server { listen 1883 so_keepalive=on; proxy_pass mqtt-server:1883; proxy_connect_timeout 1s; } }
  • 15. Nginx with TCP tunnelling #2 # PGSQL Connector to the postgres-prod upstream stream { # all upstreams include /app/nginx/upstreams.conf; server { listen 5432 so_keepalive=on; proxy_pass postgres-prod; # allows access only from the current host allow 172.17.0.0/16; deny all; } } You can connect to Pgsql on 172.17.0.1:5432 from each container in the cluster.
  • 16. Gotchas ● A valid Nginx config is required to start the container ● Only ECS RUNNING tasks are considered ● ECS ingress combines NGINX logs and the golang ones* ● It uses polling (every 10 seconds). API calls are free, S3 calls are metered. *for easy ingestion into CloudWatch
  • 17. Roadmap ● Notifications / Slack Hooks ● Polling improvements (S3) ● Automatic Route53/DNS updates ● Letsencrypt support ● Move to Openresty
  • 18. Does anyone have any questions? 18 Thanks! stefanofratini610 bitsandpieces.it @fratuz610 github.com/fratuz610/ecs-ingress

Editor's Notes

  1. As all companies we started small Trying to find our market fitness At the beginning we had 1 server with everything on it it worked fine but we had no CI/CD of any sort
  2. Looked into containers to - simplify management / high aviability - provide seemless CD capabilities - provide a cost effective solution -> margins
  3. I had managed teams that had got into the K8S journey early on and - it comes with complexities and overhead - we don't have a dedicated devops resource - it's expensive to run on AWS
  4. - It offers basic container orchestration capabilities -- Amazon Elastic Container Service (Amazon ECS) is a container orchestration service that runs and manages Docker containers - Fits our requirements for small clusters - it integrates very well with AWS services (even too well) - for example cloudwatch, VPC, EFS, code build and code deploy - it's very cheap to run - free - spot instances - It's a lock in solution but so is the whole AWS ecosystem - we lose secrets, and configuration management from K8S
  5. - documentation is lacking - learning curve is not as steep as K8s but still - incoming networking is lacking -- Specifically the ELB/ALB/NLB trio are just not good enough for anything above basic -- ELB/ALB/NLB are black boxes and expensive to run
  6. - "it's too limiting when it comes to routing" compared to NGINX - We run everything behind the same domain for SSL cert management simplicity but also to get rid of CORS - load balancers -> listeners (ports) -> rules that link to placement groups - BG: I wrote 6 or 7 blog posts a few years ago on NGINX conf and they are still the highest hits - Nginx is fast, actively developed and has an expressive configuration - that simply cannot be matched by any other way
  7. We want to use ECS because we are on Amazon + the alternative is too expensive/complicated But we want to still use Nginx for routing
  8. - ECS-Ingress - https://github.com/fratuz610/ecs-ingress - a small golang executable that spawn a vanilla nginx instance - loosely modelled after ingress-nginx but 10x simpler :) - leverages continuously updated upstreams to integrate with ECS services - reads the Nginx conf dynamically and stored in S3
  9. - it's deployed as a daemon with HOST networking - all services are deployed with Bridge networking and a mapped port of 0 - Change on the S3 bundle OR the ECS cluster => reload - We use any DNS service to add multiple A records pointing to all the members of the cluster. - Modern DNS services have a built in health check - Each instance needs to have a public IP - source control the configuration
  10. - A valid config is required - Only running tasks are considered - ECS ingress combines NGINX logs and the golang ones in 1 stadout/stderr stream for easy ingestion into Cloudwatch Logs - Uses polling (every 10 seconds). API calls are free, S3 calls are metered.
  11. - Slack Hooks support for automatic update notifications - Automatic support for Route53 updates to reflect changes in the instances attached to a ECS cluster - Letsencrypt support to automatically generate new HTTPS certificates (Gossip protocol coordination across running containers in a cluster to coordinate Letsencrypt requests) - Move to openresty to avoid potentially costly config reloads from NGINX