SlideShare ist ein Scribd-Unternehmen logo
1 von 18
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

Weitere ähnliche Inhalte

Was ist angesagt?

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 AWSShiva Narayanaswamy
 
Amazon EKS Managed Kubernetes Cluster
Amazon EKS Managed Kubernetes ClusterAmazon EKS Managed Kubernetes Cluster
Amazon EKS Managed Kubernetes Clusterkloia
 
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 2021AWSKRUG - AWS한국사용자모임
 
Deep Dive On Serverless App Development
Deep Dive On Serverless App DevelopmentDeep Dive On Serverless App Development
Deep Dive On Serverless App DevelopmentAmazon Web Services
 
[AWS Builders] 실 적용 사례로 알아보는, AWS를 활용한 WAF 보안의 장점 - 삼성SDS 천준호 프로, 컨설팅그룹 (보안기획팀)
[AWS Builders] 실 적용 사례로 알아보는, AWS를 활용한 WAF 보안의 장점 -  삼성SDS 천준호 프로, 컨설팅그룹 (보안기획팀)[AWS Builders] 실 적용 사례로 알아보는, AWS를 활용한 WAF 보안의 장점 -  삼성SDS 천준호 프로, 컨설팅그룹 (보안기획팀)
[AWS Builders] 실 적용 사례로 알아보는, AWS를 활용한 WAF 보안의 장점 - 삼성SDS 천준호 프로, 컨설팅그룹 (보안기획팀)Amazon Web Services Korea
 
基于Aws的持续集成、交付和部署 代闻
基于Aws的持续集成、交付和部署 代闻基于Aws的持续集成、交付和部署 代闻
基于Aws的持续集成、交付和部署 代闻Mason Mei
 
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,...Amazon Web Services
 
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 AWSAmazon Web Services
 
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 AWSAmazon Web Services
 
Aws container webinar day 2
Aws container webinar day 2Aws container webinar day 2
Aws container webinar day 2HoseokSeo7
 
Advanced Task Scheduling with Amazon ECS
Advanced Task Scheduling with Amazon ECSAdvanced Task Scheduling with Amazon ECS
Advanced Task Scheduling with Amazon ECSJulien SIMON
 
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 2017Amazon Web Services
 
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 2017Amazon Web Services
 
Well-Architected for Security: Advanced Session
Well-Architected for Security: Advanced SessionWell-Architected for Security: Advanced Session
Well-Architected for Security: Advanced SessionAmazon Web Services
 
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-ec2Venugopal Gummadala
 
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...Amazon Web Services
 
Secure Content Delivery with AWS
Secure Content Delivery with AWSSecure Content Delivery with AWS
Secure Content Delivery with AWSAmazon Web Services
 
(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 2014Amazon Web Services
 

Was ist angesagt? (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
 

Ähnlich wie ECS-Ingress: easy nginx load balancing across ecs services

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 ECSJoris Kuipers
 
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"Kasper Nissen
 
Making Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixMaking Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixDiana Tkachenko
 
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 BorodinProvectus
 
Localize content Devops
Localize content DevopsLocalize content Devops
Localize content Devopsmitesh_sharma
 
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...Codemotion
 
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 -...Codemotion
 
Bitbucket Pipelines - Powered by Kubernetes
Bitbucket Pipelines - Powered by KubernetesBitbucket Pipelines - Powered by Kubernetes
Bitbucket Pipelines - Powered by KubernetesNathan Burrell
 
Kubernetes Kops - Automation Night
Kubernetes Kops - Automation NightKubernetes Kops - Automation Night
Kubernetes Kops - Automation NightKasper Nissen
 
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 microservicesMicrosoft Tech Community
 
Aws + kubernetes = ❤︎
Aws + kubernetes = ❤︎Aws + kubernetes = ❤︎
Aws + kubernetes = ❤︎Anthony Stanton
 
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 KubernetesJose Galarza
 
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 Wojciech Barczyński
 
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 ScaleAmazon Web Services
 
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 ScalePahud Hsieh
 
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 MeetupLaure Vergeron
 
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.pdfAmazon Web Services
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 

Kürzlich hochgeladen (20)

Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 

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

Hinweis der Redaktion

  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