CurveCue

Serverless Microservices Technology on AWS

serverless-components

AWS also provides a Microservices implementation and integrates it nicely with its existing Serverless Architecture. This combination can make the deployments easily scalable and also reduce operational costs.

The selection of the AWS tools really depends on a case to case basis. Below is a list of tools/options and best practices when it comes to selecting the right AWS components in your architecture:

  • Choose Lambda if you want to start with a simple Microservice execution
  • And for complex executions, use docker containers with Fargate
    • You will have the responsibility to patch, upgrade, scan containers and keep all containers in ECR
    • By using Fargate, you do not have to manage host machine or worker nodes where your container runs on
  • Use Elastic Kubernetes Services (EKS) with Fargate compute service. It is an orchestrator system which is used for automatic deployments, scaling, and management of containerized applications.
  • Use Amazon API Gateway for external facing microservices endpoints.
  • Use App Mesh as an additional layer for handling inter-service communication, which is
    • responsible for monitoring and controlling traffic in microservice architectures.
    • it provides application-level networking to make it easy for your services to communicate with each other across multiple types of compute infrastructure.
    • use App Mesh proxy endpoint to access internal microservices endpoints.
  • Use Kinesis Data Streams, for handling transactions which span multiple microservices use event-sourcing patterns. Each microservices publish real time events to stream when their state changes and other microservices can read, filter and act based on message relevance.
  • Use SQS and SNS, where there is a need for asynchronous messaging between microservices.
  • Use Step Functions, when we need to orchestrate workflow involving multiple microservices
  • Logging
    • For application-level log, lambda natively support log output to CloudWatch
    • For container running on EKS, use FluentD which forwards logs from individual instances in the cluster to CloudWatch. The CloudWatch logs are combined using Elasticsearch and Kibana
  • Monitoring
    • CloudWatch Alarm
    • For EKS use Prometheus
    • Use Grafana for visualization
  • Other considerations
    • Enable Audit Trail to track changes in microservices
    • Setup CloudWatch Events to receive alert on critical events
    • Utilize caching to reduce load on microservices when applicable