DEV Community

Cover image for Immutable architecture patterns
Supratip Banerjee for AWS Community Builders

Posted on • Edited on

4 2

Immutable architecture patterns

Immutable architecture

Immutable architecture is more reliable, consistent and predictable.
Immutable means something that is not capable of change

Immutable architecture characteristics

  1. Do not try to update, upgrade or apply security patches on Server hardware, OS or security software. Rather just create a new server and deploy application on it.
  2. Stop any SSH or manual access to servers
  3. Send same code to all the environments

Alt Text

VS

Alt Text

  1. Do not download any dependency on run time, rather keep them offline in artifactory
  2. Also, if we use Canary/Blue-Green deployment possibility of downtime is almost gone

Alt Text

  1. Rollback should be setup
  2. This will stop any malicious attack because server is completely out of external interference

Canary Deployment

Routing strategy for Canary

Alt Text

Achieve Canary in AWS by

Alt Text

  1. Route 53: Route through Route 53

Alt Text

Alt Text

Minimize TTL value for faster Route 53 updation

  1. Rolling deployments for auto scaling groups

Alt Text

a. 2 auto scaling group has to be there
b. 1st auto scaling group is the production environment
c. Keep removing no of servers from the 1st
d. And keep increasing no of servers from the 2nd
e. The more instances slower updation

  1. Application load balancer and weighted target groups

Alt Text

Alt Text

a. Create target groups for load balancer and route traffic to it
b. Session stickiness can be enabled so session is not lost

  1. API Gateway

Alt Text

a. Only for REST API
b. We can set percentage of the API requests to a new API deployment for a particular stage
c. Use cloud watch metric to monitor the performance and errors of the API and react to them
d. We can also gradually increase the percentage of requests handled by the new API deployment and rollback if errors are detected

  1. Lambda alias traffic shifting

Alt Text

a. Just update the version weighs of a particular lambda alias and traffic will be routed to a new version of that function
b. Use cloud watch metric to monitor the performance and errors of the API and react to them

Alt Text

Automate using code deploy with canary deployment

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

Best Practices for Running  Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK cover image

Best Practices for Running Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK

This post discusses the process of migrating a growing WordPress eShop business to AWS using AWS CDK for an easily scalable, high availability architecture. The detailed structure encompasses several pillars: Compute, Storage, Database, Cache, CDN, DNS, Security, and Backup.

Read full post

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay