Skip to content

마일리지 정보 조회를 위한 서비스 오픈소스입니다.

License

Notifications You must be signed in to change notification settings

Team-Space-kbu/haram-mileage

Repository files navigation

Mileage service, AWS Lambda function development manual (Java)

Architecture

The project source includes function code and supporting resources:

  • src/main - A Java function.
  • build.gradle - A Gradle build file.
  • shellScript/1-create-bucket.sh, shellScript/2-deploy.sh, etc. - Shell scripts that use the AWS CLI to deploy and manage the application.

Use the following instructions to deploy the mileage application.

Requirements

Setup

Download or clone this repository.

$ git clone https://github.com/Team-Space-kbu/haram-mileage.git

To create a new bucket for deployment artifacts, run 1-create-bucket.sh.

haram-mileage$ ./shellScript/1-create-bucket.sh
make_bucket: lambda-artifacts-a5e4xmplb5b22e0d

Deploy

To deploy the application, run 2-deploy.sh.

haram-mileage$ ./shellScript/2-deploy.sh
BUILD SUCCESSFUL in 1s
Successfully packaged artifacts and wrote output template to file out.yml.
Waiting for changeset to be created..
Successfully created/updated stack - HandlerMileage

This script uses AWS CloudFormation to deploy the Lambda functions and an IAM role. If the AWS CloudFormation stack that contains the resources already exists, the script updates it with any changes to the template or function code.

You can also build the application with Maven. To use maven, add mvn to the command.

haram-mileage$ ./shellScript/2-deploy.sh mvn
[INFO] Scanning for projects...
[INFO] -----------------------< space.lambda.HandlerMileage >-----------------------
[INFO] Building HandlerMileage 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
...

Test

To invoke the function, run 3-invoke.sh.

haram-mileage$ ./shellScript/3-invoke.sh
{
    "StatusCode": 200,
    "ExecutedVersion": "$LATEST"
}
21

Let the script invoke the function a few times and then press CRTL+C to exit.

Request

To make a request using Postman

{
    "type": "search",   //student or search
    "data": "00000000"  //cardNumber
}

AWS API gateway must be used. An error occurs if the value specified is not requested.

Cleanup

To delete the application, run 4-cleanup.sh.

haram-mileage$ ./shellScript/4-cleanup.sh

About

마일리지 정보 조회를 위한 서비스 오픈소스입니다.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published