https://github.com/macnev2013/serverless-sns-lambda-java
https://github.com/macnev2013/serverless-sns-lambda-java
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/macnev2013/serverless-sns-lambda-java
- Owner: macnev2013
- Created: 2021-01-23T14:13:23.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-23T14:30:45.000Z (over 4 years ago)
- Last Synced: 2024-12-27T09:42:16.262Z (5 months ago)
- Language: Java
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Serverless Example
## Description
This is a sample code for *Serverless* framework. This project will create a SNS queue and a lambda function. Lambda function will be invoked whenever there's a new message in the SNS topic.
## Commands
#### To Deploy serverless
```
npm install
export AWS_ACCESS_KEY_ID=test
export AWS_SECRET_ACCESS_KEY=test
serverless deploy --stage local
```#### To invoke the lambda function we have to publish a message in SNS.
```
awslocal sns publish \
--topic-arn "arn:aws:sns:us-east-1:000000000000:dispatch" \
--message file://message.txt
```You can check the cloudwatch logs using the command below.
#### To retrive the log group name using:
```
awslocal logs describe-log-groups```
#### To retrive the streamname:
```
awslocal logs describe-log-streams --log-group-name
```#### To get the logs:
```
awslocal logs get-log-events --log-group-name --log-stream-name "" --limit 5
```