The Blogging Service is a serverless application built with AWS CDK that allows users to submit and search for blog posts using AWS Lambda, Amazon SQS, and Amazon OpenSearch.
-
API Gateway: Entry point for HTTP requests.
- POST
/blogs
: Triggers the Blog Submission Lambda Function. - GET
/blogs/search
: Triggers the Search Lambda Function.
- POST
-
Lambda Functions:
- Blog Submission Function: Sends new blogs to SQS.
- Blog Processing Function: Processes SQS messages and writes to OpenSearch.
- Search Function: Queries OpenSearch for blog data.
-
SQS Queue: Buffers submissions for asynchronous processing.
-
OpenSearch: Stores blog data for efficient retrieval.
- Node.js (14.x or later)
- AWS CDK (2.x)
- AWS Account with appropriate permissions.
- AWS CLI configured with credentials.
-
Clone the Repository:
git clone https://github.com/saimadib/blogging_service.git cd blogging_service
-
Install AWS CDK Globally (if not already installed):
npm install -g aws-cdk
-
Install Project Dependencies:
npm install
-
Bootstrap Your AWS Environment (if not already done):
cdk bootstrap
-
Deploy the Stack:
cdk deploy
After deployment, you can interact with the API using the following endpoints. These resources are already deployed for testing purposes.
To submit a new blog post, use the following command:
curl -X POST https://lysxoh2iwl.execute-api.ap-south-1.amazonaws.com/prod/blogs \
-H "Content-Type: application/json" \
-d '{"title": "My Blog Post", "text": "This is the content of my blog post.", "userId": "789456"}'
To search for blogs, use the following command:
curl -X GET "https://lysxoh2iwl.execute-api.ap-south-1.amazonaws.com/prod/blogs/search?query=<YOUR_QUERY>"