Lädt...


🔧 Deep Dive on Writing and Reading Data to DynamoDB Table from Lambda Functions Using AWS Cloud Map Service Discovery


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

“ I have checked the documents of AWS to get into deep dive on writing and reading data to dynamodb table from lambda functions using aws cloud map service discovery. In terms of cost, need to pay for aws cloud map service, amazon cloudwatch, aws lambda and amazon dynamodb.”

AWS Cloud Map is a fully managed solution that you can use to map logical names to the backend services and resources that your applications depend on. It also helps your applications discover resources using one of the AWS SDKs, RESTful API calls, or DNS queries. AWS Cloud Map serves only healthy resources, which can be Amazon DynamoDB tables, Amazon Simple Queue Service queues, any higher-level application services that are built using Amazon Elastic Compute Cloud instances or Amazon Elastic Container Service tasks and more. Components of AWS Cloud Map as Namespace, Service and Service Instance.

In this post, you will experience how to deep dive on writing and reading data to dynamodb table from lambda functions using aws cloud map service discovery. Here I have created an aws cloud map, amazon dynamodb, aws lambda, cloudwatch and iam role.

Architecture Overview

Image description
The architecture diagram shows the overall deployment architecture with data flow, aws cloud map, amazon dynamodb, iam role and aws lambda.

Solution overview

The blog post consists of the following phases:

  1. Create of Amazon DynamoDB with Required Configurations and IAM Role with Required Permissions
  2. Create of AWS Cloud Map with Required Configurations and Register the Service Instance with Dynamodb and Lambda
  3. Output of Creating and Running Client Application Using AWS CloudShell

Phase 1: Create of Amazon DynamoDB with Required Configurations and IAM Role with Required Permissions

  1. Open the console of Amazon DynamoDB, create a table with required configuration as table name, partition key, key type and default table settings. Also create an IAM role as trust relationship for lambda with power user access permissions.

Image description

Image description

Image description

Image description

Image description

Image description

Phase 2: Create of AWS Cloud Map with Required Configurations and Register the Service Instance with Dynamodb and Lambda

  1. Open the console of AWS Cloud Map, create a namespace with name, description and instance discovery with api calls option. In the namespace, create a service named “data-service” with default configuration. Once the service is created, register the service instance with it including instance type, service instance id and custom attributes parameters. Here while service registers in service, keep the dynamodb table name created above in the custom attribute option.

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

  1. Create a lambda as a write function with required configuration and use values in code as namespace name, service name and query parameter. Similarly, create a service and register it with lambda created as a write function.

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

  1. Create a lambda as a read function with required configuration and use values in code as namespace name, service name and query parameter. Similarly, create a service and register it with lambda created as a read function.

Image description

Image description

Image description

Image description

Image description

Phase 3: Output of Creating and Running Client Application Using AWS CloudShell

Image description

Image description

Image description

Image description

Image description

Clean-up

Delete of AWS Cloud Map, Amazon Dynamodb, AWS Lambda, CloudWatch and IAM Role.

Pricing

I review the pricing and estimated cost of this example.

Cost of AWS Cloud Map = $1.0 per million API calls + $0.10 per resource-month = $(1x8) + $(0.10x0.002) = $8.0002

Cost of Amazon Cloudwatch = $0.0

Cost of AWS Lambda = $0.0

Cost of Amazon Dynamodb = $0.0

Total Cost = $8.0002

Summary

In this post, I showed “how to deep dive on writing and reading data to dynamodb table from lambda functions using aws cloud map service discovery”.

For more details on AWS Cloud Map, Checkout Get started AWS Cloud Map, open the AWS Cloud Map console. To learn more, read the AWS Cloud Map documentation.

Thanks for reading!

Connect with me: Linkedin
Image description

...

🔧 Deploying AWS Lambda Functions with API Gateway to DynamoDB using AWS SAM on LocalStack


📈 58.79 Punkte
🔧 Programmierung

🔧 Enhancing AWS Lambda with AWS Lambda Powertools: A Complete Guide to CRUD Operations in DynamoDB


📈 56.85 Punkte
🔧 Programmierung

🔧 ESP32 to AWS: Complete IoT Solution with IoT Core, DynamoDB, and Lambda Functions in Golang


📈 49.07 Punkte
🔧 Programmierung

🔧 Pratical Differences between GCP Cloud Functions and AWS Lambda Functions


📈 46.16 Punkte
🔧 Programmierung

🔧 Deploy Your First Web App on AWS with AWS Amplify, Lambda, DynamoDB and API Gateway


📈 45.33 Punkte
🔧 Programmierung

🔧 Diferenças práticas entre GCP Cloud Functions e AWS Lambda Functions


📈 44.54 Punkte
🔧 Programmierung

🔧 How to optimize your lambda functions with AWS Lambda power tuning


📈 43.43 Punkte
🔧 Programmierung

🔧 Turbocharge your Lambda Functions with AWS Lambda Powertools for Python


📈 43.43 Punkte
🔧 Programmierung

🔧 Create a Fast Node.js Serverless Backend Using AWS Lambda and DynamoDB


📈 43.26 Punkte
🔧 Programmierung

🔧 Building an AI powered and Serverless meal planner with OpenAI, AWS Step functions, AWS Lambda and CDK


📈 40.23 Punkte
🔧 Programmierung

🐧 How to Create DynamoDB Table Using AWS CLI


📈 39.74 Punkte
🐧 Linux Tipps

🔧 Spring Boot 3 application on AWS Lambda - Part 5 Introduction to AWS Lambda Web Adapter


📈 39.69 Punkte
🔧 Programmierung

🔧 Spring Boot 3 application on AWS Lambda - Part 6 Develop application with AWS Lambda Web Adapter


📈 39.69 Punkte
🔧 Programmierung

🔧 [20 Days of DynamoDB] Day 5 - Avoid overwrites when using DynamoDB UpdateItem API


📈 38.96 Punkte
🔧 Programmierung

🔧 [20 Days of DynamoDB] Day 12 - Using the DynamoDB expression package to build Projection expressions


📈 38.96 Punkte
🔧 Programmierung

🐧 FireCracker internals: a deep dive inside the technology powering AWS Lambda


📈 38.48 Punkte
🐧 Linux Tipps

🔧 Day 22 of 100 Days of Cloud: Mastering AWS Lambda and Lambda Layers


📈 38.4 Punkte
🔧 Programmierung

🔧 Creating an AWS Lambda function to process records in Amazon DynamoDB stream


📈 37.01 Punkte
🔧 Programmierung

🔧 Applying event filters to AWS Lambda Functions with the AWS CDK


📈 36.99 Punkte
🔧 Programmierung

🐧 Lambda.sh | Haskell-like lambda functions in bash


📈 36.72 Punkte
🐧 Linux Tipps

🔧 Deploy nest app to AWS Lambda using cloud-formation stack and AWS CDK


📈 36.6 Punkte
🔧 Programmierung

🔧 Use Lambda and DynamoDB to resize S3 Image Uploaded using TERRAFORM


📈 36.56 Punkte
🔧 Programmierung

🔧 When I Tackled Rate Limiting Using AWS Step Functions and Lambda


📈 36.54 Punkte
🔧 Programmierung

🔧 Seamless Integration: Connecting AWS Lambda to RDS and Writing Data Effortlessly


📈 36.08 Punkte
🔧 Programmierung

matomo