DEV Community

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

Posted on • Edited on

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

Top comments (0)