{"id":18127662,"url":"https://github.com/importre/hello-sam","last_synced_at":"2026-05-07T08:37:25.183Z","repository":{"id":146554407,"uuid":"154522186","full_name":"importre/hello-sam","owner":"importre","description":"Kotlin 기반으로 AWS Lambda, API Gateway를 테스트 및 배포하는 샘플","archived":false,"fork":false,"pushed_at":"2018-10-31T13:17:33.000Z","size":75,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T20:16:42.363Z","etag":null,"topics":["api-gateway","aws","gradle","kotlin","kotlin-dsl","lambda","sam","sample","serverless"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/importre.png","metadata":{"files":{"readme":"readme.adoc","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-24T15:10:58.000Z","updated_at":"2019-06-21T11:28:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"5ab521a4-b579-478a-be7b-09f81e7e44c2","html_url":"https://github.com/importre/hello-sam","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/importre%2Fhello-sam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/importre%2Fhello-sam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/importre%2Fhello-sam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/importre%2Fhello-sam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/importre","download_url":"https://codeload.github.com/importre/hello-sam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247492541,"owners_count":20947545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-gateway","aws","gradle","kotlin","kotlin-dsl","lambda","sam","sample","serverless"],"created_at":"2024-11-01T09:21:49.280Z","updated_at":"2026-05-07T08:37:25.122Z","avatar_url":"https://github.com/importre.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"////\nMarked Style: asciidoctor-default\nCustom Processor: true\nCustom Preprocessor: false\n////\n:author: Jaewe Heo\n:email: jaeweheo@gmail.com\n:doctype: article\n:toc:\n\n= hello-sam\n\nhttps://github.com/importre?utf8=%E2%9C%93\u0026tab=repositories\u0026q=sample[image:https://img.shields.io/badge/importre-sample-yellow.svg[alt=importre.sample]]\n\n\u003e https://kotlinlang.org/[Kotlin] 기반으로 AWS https://aws.amazon.com/lambda/[Lambda], https://aws.amazon.com/api-gateway/[API Gateway]를 테스트 및 배포하는 샘플\n\n\n== Prerequisites\n\n* https://docs.aws.amazon.com/cli/latest/userguide/installing.html[awscli]\n* https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html[aws-sam-cli]\n\n\n== Initialization\n\n.build.gradle.kts\n[source, kotlin, linenums]\n----\nsam {\n    s3Bucket = \"riiid-dev-hello\"\n    stackName = \"hello-sam\"\n    \"HelloSamFunction\"(SamResource.Type.FUNCTION) {                     // \u003c1\u003e\n        properties {\n            handler = \"com.importre.example.Hello::handleRequest\"\n            codeUri = \"$buildDir/libs/${project.name}-$version-all.jar\" // \u003c2\u003e\n            runtime = SamResource.Properties.Runtime.JAVA8              // \u003c3\u003e\n            events {\n                \"HelloSam\"(SamEvent.Type.API) {                         // \u003c4\u003e\n                    properties {\n                        path = \"/hello\"\n                        method = SamEvent.Properties.Method.GET\n                    }\n                }\n            }\n        }\n    }\n}\n----\n\u003c1\u003e 리소스가 함수면 타입 생략 가능 (``\"HelloSamFunction\" { ... }``)\n\u003c2\u003e 생략 가능 (기본값: ``build/libs/${project.name}-$version-all.jar``)\n\u003c3\u003e 생략 가능 (기본값: java8)\n\u003c4\u003e 이벤트 타입이 API면 생략 가능 (``\"HelloSam { ... }``)\n\n\n== How to use\n\n=== Test\n\n.shell\n[source, zsh, linenums]\n----\n% ./gradlew test\n----\n\n=== SAM local\n\n.shell\n[source, zsh, linenums]\n----\n% ./gradlew runLocalSamApp\n----\n\nhttp://127.0.0.1:3000/hello or http://127.0.0.1:3000/hello?name=world 확인\n\n=== Deployment\n\n.shell\n[source, zsh, linenums]\n----\n% ./gradlew deploySamApp\n----\n\n\u003e 내부적으로는 다음과 같이 실행됨\n\n. ``clean``(``build`` 폴더 청소)\n. ``shadowJar``(``jar`` 파일 생성)\n. ``generateTemplateYaml``(``sam`` 기반으로 ``template.yaml``을 ``build/generated``에 생성)\n. ``packageSamApp``(``sam package`` 명령 실행)\n. ``deploySamApp``(``sam deploy`` 명령 실행)\n\n\n== References\n\n* https://github.com/gradle/kotlin-dsl[gradle/kotlin-dsl]\n* https://docs.aws.amazon.com/lambda/latest/dg/java-programming-model.html[Building Lambda Functions with Java]\n** https://github.com/aws/aws-sdk-java[aws/aws-sdk-java]\n* https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md[AWS Serverless Application Model (SAM)]\n* https://aws.amazon.com/ko/blogs/korea/new-aws-sam-local-beta-build-and-test-serverless-applications-locally/[AWS SAM Local]\n\n\n== Future works\n\n* ``sam``에 모자른 https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md[SAM 스펙] 구현하기 → Plugin으로 배포\n** 예외처리\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimportre%2Fhello-sam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimportre%2Fhello-sam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimportre%2Fhello-sam/lists"}