serverless / examples

Serverless Examples – A collection of boilerplates and examples of serverless architectures built with the Serverless Framework on AWS Lambda, Microsoft Azure, Google Cloud Functions, and more.
https://www.serverless.com/examples/
Other
11.45k stars 4.47k forks source link

feat: Add ruby sqs dynamodb example #620

Closed Pigius closed 3 years ago

Pigius commented 3 years ago

Big picture behind

Currently, there aren't many examples of using the serverless approach with Ruby for AWS. Ruby is a great and mature language with a great community and lots of gems.

General message

This is an example of the usage of the SQS with DynamoDB, API Gateway, and AWS Lambda functions, and Cloudwatch for monitoring. The service is for the purpose of creating lottery coupons for people. Each and every coupon consists of the id, first_name, last_name and coupon_value as well as of created_at timestamp. API Gateway is triggering producing an SQS message, and then the consumer will create a record within the DynamoDB table. The incoming requests are validated with the usage of dry-schema.

The diagram could be found here: aws-serverless-diagram

For the purpose of SQS part, the Lift construct was used, to allow using AWS CDK constructs functionalities.

Extra points:

Last important point regarding the example: In the Lift, queue construct it is mentioned that we don't need to set up permission for the lambda. It's true, but if you will add extra IAM statements, it will not work anymore, and you need to manually add this to the Serverless.yml

Update: I've raised the issue within the Lift repository. The issue is due to deprecated usage of provider.iamRoleStatements in Lift.

Pigius commented 3 years ago

@pgrzesik extra modification to the PR, As the https://www.npmjs.com/package/serverless-lift, has a new release 1.1.1 which included the fix for the https://github.com/getlift/lift/issues/47. So I've updated:

o5 commented 2 years ago

@Pigius Could you please share the link for diagram tool which you are used? It looks good 😊

Pigius commented 2 years ago

@Pigius Could you please share the link for diagram tool which you are used? It looks good 😊

@o5 Hi, This is https://excalidraw.com/. It's free and open-source - it's brilliant! However, I recommend to always have a file with the .excalidraw extension somewhere locally to be able to edit the diagram continuously, as in our IT reality everything changes quite often :)

Pigius commented 2 years ago

@o5 Please also see https://libraries.excalidraw.com/?theme=light&sort=default#slobodan-aws-serverless as there are libraries with a great icons :)

o5 commented 2 years ago

@Pigius Thanks! I used https://asciiflow.com which resolves the frequent changes but result from excalidraw looks better :)

Pigius commented 2 years ago

@o5 good to know, thanks!