AWS SERVERLESS ARCHITECTURE IN JAVA
ARCHITECTURE DIAGRAM:
We used Below AWS Service to achieve the above architecture.
1.S3 Bucket
2.API Gateway
3.Lambda Function
4.Dynamo DB
How to Deploy Lambda Function into AWS using eclipse:
Click Install New Software Enter below URL “ https://aws.amazon.com/eclipse”
It will prompt you for an AWS access key and a secret key after installation. Enter your Access Key and Secret Key.
STEP 2:
Make a new Amazon Web Services Lambda Project.
Enter the project name, group id, and artefact id. In the Lambda Function Handler, we need to mention the class name and select the input type.
We need to choose an input type based on our requirements.
- 2.DynamoDB S3 Event3. Request Handler for Streams4. Social Media Event 5. Kinesis Event5. Cognito Event
Once we complete our business logic, we can deploy our lambda function into an S3 bucket.
Right-click our application package Select Amazon Web Service and click Upload to deploy the Lambda function to an S3 bucket. While uploading, we need to mention the function name.
Our Lambda Function Name: SUM
API Gateway Configuration:
After clicking Create API, the below window will display.
Enter the API name and click “Create API.” The below window will display
Then, select ‘ACTIONS’ from the drop-down menu. The window shown below will appear.
After Click ‘Create Resource’ below Window Will display.
- Enable or disable Proxy resource (its based on our requirement)
- Enable API Gateway CORS
Once entered all the information click ‘Create Resource’ ,Below window will display.
Select ‘Lambda Region’ function upload s3 Bucket Region.
Select Lambda function and click save
Once saved successfully API will create. Click API and Deploy API
After Click Deploy API below window will display.
Enter the stage name and click “Deploy.” Our API is ready to use. A sample API format is provided below.
(Note :API Link Will not work)
https://e41su015ec.execute-api.ap-south-1.amazonaws.com/DEV/sum?param1=100&par am2=100
e41su015ec.execute-api.ap-south-1.amazonaws.com->API End Point
DEV->API Stage Name
sum->Lambda Function Name
param1=100&par am2=100=>Request Parameter