This project focuses on deploying a scalable, reliable, and maintainable notification system on AWS. The system consists of two primary microservices:
- Notification API: Receives notification requests and queues them.
- Email Sender: Processes messages from the queue and sends emails.
- Requirements
- Architecture
- Infrastructure as Code (IaC)
- Deployment Process
- Scalability and Reliability
- Observability
- Security
- Bonus Points
- Instructions
- Evaluation
Use one of the following tools to provision infrastructure:
- Terraform
- Terraform With AWS CDK
- AWS CDK (TypeScript or Python)
- Pulumi (TypeScript or Python)
- Services: Deploy the Notification API and Email Sender using AWS ECS Fargate.
- Service Mesh: Use AWS App Mesh for service mesh capabilities and AWS Cloud Map for service discovery.
- Message Queue: Use Amazon SQS to queue messages between services.
- Docker Images: Create and manage Docker images.
- Implement auto-scaling strategies based on CPU usage (70% threshold).
- Ensure system resilience and automatic recovery from failures.
- Set up monitoring and logging using AWS CloudWatch.
- Track key metrics such as queue length, processing times, and error rates.
- Implement least-privilege IAM roles.
- Securely store sensitive information using AWS Secrets Manager or Parameter Store.
The architecture consists of:
- Notification API (ECS/Fargate): Receives requests and queues them.
- Email Sender (ECS/Fargate): Processes queued messages and sends emails.
- AWS App Mesh: Provides service mesh capabilities.
- AWS Cloud Map: Facilitates service discovery.
- Amazon SQS: Queues messages between the Notification API and Email Sender.
- Amazon CloudWatch: Monitors the system.
Provision the infrastructure using:
- Terraform
- AWS CDK (TypeScript/Python)
- Pulumi (TypeScript/Python)
Ensure the IaC code adheres to best practices, is well-documented, and structured properly.
- Review Microservices: Understand the provided Notification API and Email Sender microservices.
- Design Deployment: Plan the deployment strategy considering scalability, reliability, and security.
- Create Dockerfiles:
- Write Dockerfiles for the Notification microservices.
- Build and test the Docker images locally.
- Push to Amazon ECR:
- Create Amazon ECR repositories for each microservice.
- Push the Docker images to the respective ECR repositories.
- Provision Infrastructure: Use the chosen IaC tool to provision necessary AWS services.
- Deploy Services: Deploy the microservices using AWS ECS Fargate.
- Implement Logging: Ensure ECS tasks log application output to CloudWatch.
- Auto-Scaling Configuration: Implement auto-scaling based on 70% CPU usage threshold.
- Health Check:
- Identify health check endpoints in the microservice code.
- Configure ECS health check paths using the identified endpoints.
- Test and Verify: Ensure services are functioning correctly, can scale, and handle failures.
- Document: Prepare and include a README file explaining the deployment process, architecture, and operational considerations.
- Implement a CI/CD pipeline using AWS CodePipeline or GitHub Actions.
- Propose and implement a strategy for zero-downtime deployments.
- Review Microservices and Configuration: Understand the Notification API and Email Sender interaction.
- Design Deployment: Strategize considering all requirements.
- Create Dockerfiles: Write Dockerfiles, build, and test Docker images.
- Push to Amazon ECR: Create ECR repositories and push Docker images.
- Provision Infrastructure: Implement using Terraform, AWS CDK, or Pulumi.
- Deploy Services: Use AWS ECS or Fargate.
- Implement Logging: Ensure logs are sent to CloudWatch.
- Configure Auto-Scaling: Set auto-scaling based on 70% CPU usage.
- Configure Health Checks: Implement and configure health check paths.
- Test and Verify: Ensure system correctness, scalability, and fault tolerance.
- Document: Prepare and include a README file explaining the deployment process and architecture.
Your submission will be evaluated based on:
- Quality, clarity, and maintainability of IaC code.
- Robustness and appropriateness of deployment architecture.
- Use and understanding of specified AWS services and best practices.
- Clarity and completeness of documentation and operational instructions.
Submit your IaC code, configuration files, and README as a ZIP file or a link to a version-controlled repository (e.g., GitHub). Fork the repo, complete the assessment, and send a pull request.
✨ This workspace has been generated by Nx, Smart Monorepos · Fast CI. ✨
Enhance your Nx experience by installing Nx Console for your favorite editor. Nx Console provides an interactive UI to view your projects, run tasks, generate code, and more! Available for VSCode, IntelliJ and comes with a LSP for Vim users.
Run npm install
and
Run npx nx serve pt-notification-service
to start the development server. Happy coding!
Run npx nx build pt-notification-service
to build the application. The build artifacts are stored in the output directory (e.g. dist/
or build/
), ready to be deployed.
To execute tasks with Nx use the following syntax:
npx nx <target> <project> <...options>
You can also run multiple targets:
npx nx run-many -t <target1> <target2>
..or add -p
to filter specific projects
npx nx run-many -t <target1> <target2> -p <proj1> <proj2>
Targets can be defined in the package.json
or projects.json
. Learn more in the docs.
Nx comes with local caching already built-in (check your nx.json
). On CI you might want to go a step further.
Run npx nx graph
to show the graph of the workspace.
It will show tasks that you can run with Nx.