GithubHelp home page GithubHelp logo

aws_microservice_with_logs_and_tracing's Introduction

Lambda microservice in AWS with logs and tracing

This project was built on top of the AWS Serverless Application Model. First, I will describe how to build the model and then add the necessary dependencies to personlize the logs

[x] Logging implementation [x] X-ray Tracing [x] CloudWatch Centralization [x] Documentation

If we want to modify to insert more tracing and logging we Can do it adding the following dependencies to the Toml file:

Tracing

Then we need to use them in the main.rs

use_trace

And finally we add those into the async function:

tracing

Nonetheless the SAM framework builds by default a tracing mechanism:

tracing

And logs by default, the following is a screenshot after adding an item to the Dynamo table:

test_passed

To know more about SAM, read the following instructions.

AWS Serverless Application with Rust Lambda and DynamoDB Integration

Overview

This repository contains the source code and configuration files for a serverless application built on AWS using the Serverless Application Model (SAM). The application consists of a Lambda function written in Rust, which interacts with a DynamoDB database to update data based on incoming payloads.

Prerequisites

Before deploying and running this serverless application, ensure that you have the following prerequisites set up:

  • AWS account

  • AWS CLI installed and configured

  • SAM CLI installed

  • Rust programming language installed (for building the Lambda function locally)

Getting Started

To deploy and run the serverless application (SAM), follow these steps:

  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate

Sometimes you need to deactivate conda

conda deactivate
  1. install the necessary dependencies:
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /
aws configure

Here you need to add the necessary IAM permissions:

permissions

pip install aws-sam-cli

Install cargo if you don't have it:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  1. Deploy the Application:

    sam deploy --guided

    Follow the prompts to configure your deployment. SAM will package and deploy your application stack to AWS.

    deployment

  2. Test the Application: Once the deployment is complete, you can test the application by invoking the Lambda function or sending payloads to trigger updates in the DynamoDB table.

    test

Configuration

  • Lambda Function: The Rust code for the Lambda function resides in the lambda_function directory. Update the code logic in src/main.rs according to your requirements.

lambda

  • DynamoDB Table: The application interacts with a DynamoDB table to update data. Ensure that you have the necessary permissions and configuration set up in AWS.

Folder Structure

  • lambda_function: Contains the source code for the Rust Lambda function.
  • template.yaml: SAM template file defining the AWS resources for the serverless application.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Thanks to the AWS team for providing the Serverless Application Model (SAM) framework.
  • Inspiration and guidance from various serverless application examples and tutorials.

Feel free to reach out to me if you have any questions or need further assistance!

aws_microservice_with_logs_and_tracing's People

Contributors

bugarin10 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.