Posts

AWS Code Commit with Git Basics - I

Image
AWS Code Commit is a fully managed, secure, private Git repository service used to store, version, and collaborate on source code and other assets. It eliminates the need to host your own Git server and integrates tightly with AWS services. Let's start with creating a code commit repository from the AWS Console: Repository name is " book " and I am going to create a file from the console by the name called " facts.txt " with the below content. Here is the commit message for the file. Now, our file is ready. Take a note at the " Reference " as " main " which shows the file is created under main branch. No need to worry about the terms branch, commit and others. This series covers it. Now, our file is ready. Consider the file under the "main" branch is the ONE VIEWED/USED by everyone. Now, we have been asked to make changes to the file. Change the numbers from 8,848.86 to ~ 9,000 meters. In real, no organization allows to make chan...

DynamoDB Streams

Image
  DynamoDB Streams are one of the most powerful—but often under‑explained—features in DynamoDB. A DynamoDB Stream captures every change to items in a table: INSERT MODIFY REMOVE You can then process these changes using: AWS Lambda Kinesis Custom consumers This is how you build event‑driven architectures with DynamoDB. Enable Streams on the Table: You choose a stream view type, e.g.: NEW_IMAGE → only the new item OLD_IMAGE → only the old item NEW_AND_OLD_IMAGES → both KEYS_ONLY → only keys I have table created by the name called " order ". I have enabled "Streams" to capture the changes to the table. And I have added the lambda function to process the streams. Lambda gets triggered , whenever there is a change in the DB items. Below is the lambda snippet: import json def lambda_handler(event, context):     for record in event[ "Records" ]:         event_name = record[ "eventName" ]         keys = record[ "dynamo...

APIGW + Lambda + DynamoDB

Image
  In this post, let see a demo application which is accessible by the users via API GW and the back end logic for the application is served by AWS lambda function. For persistent storage, we are using DynamoDB table. Lets start with DynamoDB table: I created a DynamoDB table by the name " employee_table ". Table has a primary key " employee_id " of datatype Number. So, any query to the table must be made through the key " employee_id ", else we need to scan the entire table. Let's add an item to the table from console. Now, we added an item to the table. Let's do the same and other action via API GW and Lambda Functions. Let's create a lambda function. One lambda function, based on the query parameter it invokes the function within the lambda. import json import boto 3 from botocore.exceptions import ClientError from decimal import Decimal from boto 3 .dynamodb.conditions import Key # Initialize the DynamoDB client dynamodb = boto 3 .resource(...

API Gateway with AWS S3

Image
  In this post, we will see how to read objects from S3 using AWS API GW. I already have a bucket with a JSON file. Here is the lambda function for reading the object from the bucket. In the below code, I have hardcoded the bucket name and the object name. import json import boto3 client = boto3.client( 's3' ) def lambda_handler ( event , context ):     response = client.get_object(     Bucket = 'demo-001-first' ,-------------> Bucket Name     Key = 'bucket1.json' ,------------------> Object Name )     # convert from streaming to bytes     data_bytes = response[ 'Body' ].read()     #bytes to string     data_strings = data_bytes.decode( "UTF-8" ) # convert from strings to dict     data_dict = json.loads(data_strings)     return {         'statusCode' : 200 ,         'body' : data_dict     } Finally, I have my API GW (REST) as belo...

Agentic AI - Series 5

Image
                                                              Hope you all having fun with our Agentic AI series. In this blog, we will see how to design a MAS (Multi Agent System) using CrewAI. CrewAI is a popular framework for building production grade AI systems.  We know that every agent needs Role. Goal. Backstory. Tasks. Tools MAS is nothing but completing a work with the help or collaboration of one more agents. Lets understand with a real life example. We are going to design a application which involves in recommending food for diabetic patients based on the given ingredients. To accomplish the task, we need a agent called " Chef ". Role - Experience Chef. Goal - Prepare delicious food based on the given ingredient. Backstory : You are an experienced chef and received accolades for preparing ...