DevOps Event Driven Architecture — Part 2
Overview 🔍
In Lab 1, we set up the UI and identified the "Like" click as our starting event. Now, in Lab 2, we dive into the backend by provisioning the core cloud infrastructure using Terraform. We will define the necessary AWS resources – the database to store counts, the event stream to carry like events, and the storage for raw data – all as code.
Purpose 🎯
The purpose of this lab is to:
- Introduce Infrastructure as Code (IaC) principles using Terraform.
- Provision the foundational AWS resources required for our event pipeline:
- DynamoDB Table (
MovieLikesTable): To store the aggregated like counts for each movie. - Kinesis Data Stream (
MovieLikesStream): To act as the central event bus for incoming like events. - S3 Bucket (
raw-likes-bucket): To archive the raw like events for potential future analysis or reprocessing.
- DynamoDB Table (
- Organize our Terraform code into logical files (
main.tf,variables.tf,outputs.tf) 📂. - Understand the role of each AWS service in our architecture.
Lab Environment 🛠️
Building upon Lab 1, you will now need:
- AWS Account: Access credentials configured locally for Terraform.
- Terraform CLI: Installed and configured.
- AWS CLI: Installed and configured (useful for verification).
- Code editor and Git .
What We'll Accomplish ✅
In this lab, you will:
- Set up your Terraform project structure.
- Define the AWS provider and region.
- Write Terraform code to create the DynamoDB table, Kinesis Data Stream, and S3 bucket.
- Use Terraform
localsfor consistent resource naming. - Initialize Terraform (
terraform init). - Preview the infrastructure changes (
terraform plan). - Apply the changes to provision resources in AWS (
terraform apply). - Verify resource creation in the AWS Management Console.
- Initialize Git and push your IaC code to GitHub.
Infrastructure as Code: The Terraform Advantage ⚙️
Instead of manually clicking through the AWS console, we define our infrastructure in configuration files. This IaC approach offers significant benefits:
- Repeatability: Easily recreate the same infrastructure in different environments.
- Version Control: Track changes to your infrastructure just like application code using Git.
- Collaboration: Teams can work on infrastructure definitions together.
- Automation: Integrate infrastructure provisioning into CI/CD pipelines.
We are defining the "stage" where our event-driven play will unfold. By the end of this lab, our core data stores and the event highway (Kinesis) will be ready and waiting for data.
Let's start coding our cloud infrastructure!
AWS
Ubuntu