├── {{ cookiecutter.project_slug }}
└── .gitignore
├── templates
├── java11
│ ├── cookiecutter-aws-sam-hello-powertools-java-gradle
│ │ ├── {{ cookiecutter.project_slug }}
│ │ │ ├── HelloWorldFunction
│ │ │ │ ├── settings.gradle
│ │ │ │ ├── gradle
│ │ │ │ │ └── wrapper
│ │ │ │ │ │ ├── gradle-wrapper.properties
│ │ │ │ │ │ └── gradle-wrapper.jar
│ │ │ │ ├── src
│ │ │ │ │ ├── main
│ │ │ │ │ │ ├── resources
│ │ │ │ │ │ │ └── log4j2.xml
│ │ │ │ │ │ └── java
│ │ │ │ │ │ │ └── helloworld
│ │ │ │ │ │ │ └── App.java
│ │ │ │ │ └── test
│ │ │ │ │ │ └── java
│ │ │ │ │ │ └── helloworld
│ │ │ │ │ │ └── AppTest.java
│ │ │ │ ├── build.gradle
│ │ │ │ ├── gradlew.bat
│ │ │ │ └── gradlew
│ │ │ ├── events
│ │ │ │ └── event.json
│ │ │ ├── template.yaml
│ │ │ └── README.md
│ │ └── cookiecutter.json
│ └── cookiecutter-aws-sam-hello-powertools-java-maven
│ │ ├── cookiecutter.json
│ │ └── {{ cookiecutter.project_slug }}
│ │ ├── HelloWorldFunction
│ │ ├── src
│ │ │ ├── main
│ │ │ │ ├── resources
│ │ │ │ │ └── log4j2.xml
│ │ │ │ └── java
│ │ │ │ │ └── helloworld
│ │ │ │ │ └── App.java
│ │ │ └── test
│ │ │ │ └── java
│ │ │ │ └── helloworld
│ │ │ │ └── AppTest.java
│ │ └── pom.xml
│ │ ├── events
│ │ └── event.json
│ │ ├── template.yaml
│ │ └── README.md
├── java8
│ ├── cookiecutter-aws-sam-hello-powertools-java-gradle
│ │ ├── {{ cookiecutter.project_slug }}
│ │ │ ├── HelloWorldFunction
│ │ │ │ ├── settings.gradle
│ │ │ │ ├── gradle
│ │ │ │ │ └── wrapper
│ │ │ │ │ │ ├── gradle-wrapper.properties
│ │ │ │ │ │ └── gradle-wrapper.jar
│ │ │ │ ├── src
│ │ │ │ │ ├── main
│ │ │ │ │ │ ├── resources
│ │ │ │ │ │ │ └── log4j2.xml
│ │ │ │ │ │ └── java
│ │ │ │ │ │ │ └── helloworld
│ │ │ │ │ │ │ └── App.java
│ │ │ │ │ └── test
│ │ │ │ │ │ └── java
│ │ │ │ │ │ └── helloworld
│ │ │ │ │ │ └── AppTest.java
│ │ │ │ ├── build.gradle
│ │ │ │ ├── gradlew.bat
│ │ │ │ └── gradlew
│ │ │ ├── events
│ │ │ │ └── event.json
│ │ │ ├── template.yaml
│ │ │ └── README.md
│ │ └── cookiecutter.json
│ └── cookiecutter-aws-sam-hello-powertools-java-maven
│ │ ├── cookiecutter.json
│ │ └── {{ cookiecutter.project_slug }}
│ │ ├── HelloWorldFunction
│ │ ├── src
│ │ │ ├── main
│ │ │ │ ├── resources
│ │ │ │ │ └── log4j2.xml
│ │ │ │ └── java
│ │ │ │ │ └── helloworld
│ │ │ │ │ └── App.java
│ │ │ └── test
│ │ │ │ └── java
│ │ │ │ └── helloworld
│ │ │ │ └── AppTest.java
│ │ └── pom.xml
│ │ ├── events
│ │ └── event.json
│ │ ├── template.yaml
│ │ └── README.md
└── java8.al2
│ ├── cookiecutter-aws-sam-hello-powertools-java-gradle
│ ├── {{ cookiecutter.project_slug }}
│ │ ├── HelloWorldFunction
│ │ │ ├── settings.gradle
│ │ │ ├── gradle
│ │ │ │ └── wrapper
│ │ │ │ │ ├── gradle-wrapper.properties
│ │ │ │ │ └── gradle-wrapper.jar
│ │ │ ├── src
│ │ │ │ ├── main
│ │ │ │ │ ├── resources
│ │ │ │ │ │ └── log4j2.xml
│ │ │ │ │ └── java
│ │ │ │ │ │ └── helloworld
│ │ │ │ │ │ └── App.java
│ │ │ │ └── test
│ │ │ │ │ └── java
│ │ │ │ │ └── helloworld
│ │ │ │ │ └── AppTest.java
│ │ │ ├── build.gradle
│ │ │ ├── gradlew.bat
│ │ │ └── gradlew
│ │ ├── events
│ │ │ └── event.json
│ │ ├── template.yaml
│ │ └── README.md
│ └── cookiecutter.json
│ └── cookiecutter-aws-sam-hello-powertools-java-maven
│ ├── cookiecutter.json
│ └── {{ cookiecutter.project_slug }}
│ ├── HelloWorldFunction
│ ├── src
│ │ ├── main
│ │ │ ├── resources
│ │ │ │ └── log4j2.xml
│ │ │ └── java
│ │ │ │ └── helloworld
│ │ │ │ └── App.java
│ │ └── test
│ │ │ └── java
│ │ │ └── helloworld
│ │ │ └── AppTest.java
│ └── pom.xml
│ ├── events
│ └── event.json
│ ├── template.yaml
│ └── README.md
├── CODE_OF_CONDUCT.md
├── cookiecutter.json
├── hooks
├── pre_gen_project.py
└── post_gen_project.py
├── LICENSE
├── README.md
├── .github
├── dependabot.yml
└── workflows
│ ├── auto-merge.yml
│ └── build.yml
├── manifest.json
└── CONTRIBUTING.md
/{{ cookiecutter.project_slug }}/.gitignore:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'HelloWorldFunction'
2 |
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'HelloWorldFunction'
2 |
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'HelloWorldFunction'
2 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/cookiecutter.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_name": "My Project",
3 | "project_slug": "{{ cookiecutter.project_name.replace('_', ' ').title().replace(' ', '') }}"
4 | }
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-maven/cookiecutter.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_name": "My Project",
3 | "project_slug": "{{ cookiecutter.project_name.replace('_', ' ').title().replace(' ', '') }}"
4 | }
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-maven/cookiecutter.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_name": "My Project",
3 | "project_slug": "{{ cookiecutter.project_name.replace('_', ' ').title().replace(' ', '') }}"
4 | }
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/cookiecutter.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_name": "My Project",
3 | "project_slug": "{{ cookiecutter.project_name.replace('_', ' ').title().replace(' ', '') }}"
4 | }
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-maven/cookiecutter.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_name": "My Project",
3 | "project_slug": "{{ cookiecutter.project_name.replace('_', ' ').title().replace(' ', '') }}"
4 | }
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/cookiecutter.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_name": "My Project",
3 | "project_slug": "{{ cookiecutter.project_name.replace('_', ' ').title().replace(' ', '') }}"
4 | }
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | ## Code of Conduct
2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
4 | opensource-codeofconduct@amazon.com with any additional questions or comments.
5 |
--------------------------------------------------------------------------------
/cookiecutter.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_name": "My Project",
3 | "project_slug": "{{ cookiecutter.project_name.replace('_', ' ').title().replace(' ', '') }}",
4 | "runtime": ["java11", "java8.al2", "java8"],
5 | "dependency_manager": ["Maven", "Gradle"],
6 | "_templates_repo": "https://github.com/aws-samples/cookiecutter-aws-sam-powertools-java"
7 | }
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/cookiecutter-aws-sam-powertools-java/HEAD/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/cookiecutter-aws-sam-powertools-java/HEAD/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/cookiecutter-aws-sam-powertools-java/HEAD/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/hooks/pre_gen_project.py:
--------------------------------------------------------------------------------
1 | import re
2 | import sys
3 |
4 | TERMINATOR = "\x1b[0m"
5 | INFO = "\x1b[1;33m [INFO]: "
6 | SUCCESS = "\x1b[1;32m [SUCCESS]: "
7 | HINT = "\x1b[3;33m"
8 | FAIL = "\033[91m [ERROR]"
9 |
10 | PROJECT_SLUG_REGEX = r'^[_a-zA-Z][_a-zA-Z0-9]+$'
11 |
12 | project_slug = '{{ cookiecutter.project_slug }}'
13 |
14 | if not re.match(PROJECT_SLUG_REGEX, project_slug):
15 | print(FAIL + '"%s" is not a valid project_slug because does not match the RegEx: ^[_a-zA-Z][_a-zA-Z0-9]+$ ' % project_slug + TERMINATOR)
16 |
17 | # exits with status 1 to indicate failure
18 | sys.exit(1)
19 |
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7 | the Software, and to permit persons to whom the Software is furnished to do so.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
11 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
12 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
13 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15 |
16 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/test/java/helloworld/AppTest.java:
--------------------------------------------------------------------------------
1 | package helloworld;
2 |
3 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
4 | import com.amazonaws.xray.AWSXRay;
5 | import org.junit.After;
6 | import org.junit.Before;
7 | import org.junit.Test;
8 |
9 | import static org.junit.Assert.*;
10 |
11 | public class AppTest {
12 |
13 | @Test
14 | public void successfulResponse() {
15 | App app = new App();
16 | APIGatewayProxyResponseEvent result = app.handleRequest(null, null);
17 | assertEquals(result.getStatusCode().intValue(), 200);
18 | assertEquals(result.getHeaders().get("Content-Type"), "application/json");
19 | String content = result.getBody();
20 | assertNotNull(content);
21 | assertTrue(content.contains("\"message\""));
22 | assertTrue(content.contains("\"hello world\""));
23 | assertTrue(content.contains("\"location\""));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/test/java/helloworld/AppTest.java:
--------------------------------------------------------------------------------
1 | package helloworld;
2 |
3 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
4 | import com.amazonaws.xray.AWSXRay;
5 | import org.junit.After;
6 | import org.junit.Before;
7 | import org.junit.Test;
8 |
9 | import static org.junit.Assert.*;
10 |
11 | public class AppTest {
12 |
13 | @Test
14 | public void successfulResponse() {
15 | App app = new App();
16 | APIGatewayProxyResponseEvent result = app.handleRequest(null, null);
17 | assertEquals(result.getStatusCode().intValue(), 200);
18 | assertEquals(result.getHeaders().get("Content-Type"), "application/json");
19 | String content = result.getBody();
20 | assertNotNull(content);
21 | assertTrue(content.contains("\"message\""));
22 | assertTrue(content.contains("\"hello world\""));
23 | assertTrue(content.contains("\"location\""));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/test/java/helloworld/AppTest.java:
--------------------------------------------------------------------------------
1 | package helloworld;
2 |
3 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
4 | import com.amazonaws.xray.AWSXRay;
5 | import org.junit.After;
6 | import org.junit.Before;
7 | import org.junit.Test;
8 |
9 | import static org.junit.Assert.*;
10 |
11 | public class AppTest {
12 |
13 | @Test
14 | public void successfulResponse() {
15 | App app = new App();
16 | APIGatewayProxyResponseEvent result = app.handleRequest(null, null);
17 | assertEquals(result.getStatusCode().intValue(), 200);
18 | assertEquals(result.getHeaders().get("Content-Type"), "application/json");
19 | String content = result.getBody();
20 | assertNotNull(content);
21 | assertTrue(content.contains("\"message\""));
22 | assertTrue(content.contains("\"hello world\""));
23 | assertTrue(content.contains("\"location\""));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/test/java/helloworld/AppTest.java:
--------------------------------------------------------------------------------
1 | package helloworld;
2 |
3 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
4 | import com.amazonaws.xray.AWSXRay;
5 | import org.junit.After;
6 | import org.junit.Before;
7 | import org.junit.Test;
8 |
9 | import static org.junit.Assert.*;
10 |
11 | public class AppTest {
12 |
13 | @Test
14 | public void successfulResponse() {
15 | App app = new App();
16 | APIGatewayProxyResponseEvent result = app.handleRequest(null, null);
17 | assertEquals(result.getStatusCode().intValue(), 200);
18 | assertEquals(result.getHeaders().get("Content-Type"), "application/json");
19 | String content = result.getBody();
20 | assertNotNull(content);
21 | assertTrue(content.contains("\"message\""));
22 | assertTrue(content.contains("\"hello world\""));
23 | assertTrue(content.contains("\"location\""));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/test/java/helloworld/AppTest.java:
--------------------------------------------------------------------------------
1 | package helloworld;
2 |
3 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
4 | import com.amazonaws.xray.AWSXRay;
5 | import org.junit.After;
6 | import org.junit.Before;
7 | import org.junit.Test;
8 |
9 | import static org.junit.Assert.*;
10 |
11 | public class AppTest {
12 |
13 | @Test
14 | public void successfulResponse() {
15 | App app = new App();
16 | APIGatewayProxyResponseEvent result = app.handleRequest(null, null);
17 | assertEquals(result.getStatusCode().intValue(), 200);
18 | assertEquals(result.getHeaders().get("Content-Type"), "application/json");
19 | String content = result.getBody();
20 | assertNotNull(content);
21 | assertTrue(content.contains("\"message\""));
22 | assertTrue(content.contains("\"hello world\""));
23 | assertTrue(content.contains("\"location\""));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/build.gradle:
--------------------------------------------------------------------------------
1 | plugins{
2 | id 'java'
3 | id 'io.freefair.aspectj.post-compile-weaving' version '6.6.2'
4 | }
5 |
6 | repositories {
7 | mavenCentral()
8 | }
9 |
10 | // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests
11 | test {
12 | environment "LAMBDA_TASK_ROOT", "handler"
13 | }
14 |
15 | dependencies {
16 | aspect 'software.amazon.lambda:powertools-logging:1.12.0'
17 | aspect 'software.amazon.lambda:powertools-tracing:1.12.0'
18 | aspect 'software.amazon.lambda:powertools-metrics:1.12.0'
19 |
20 | implementation 'com.amazonaws:aws-lambda-java-core:1.2.1'
21 | implementation 'com.amazonaws:aws-lambda-java-events:3.11.0'
22 |
23 | implementation 'org.apache.logging.log4j:log4j-api:2.17.2'
24 | implementation 'org.apache.logging.log4j:log4j-core:2.19.0'
25 |
26 | testImplementation 'junit:junit:4.13.2'
27 | }
28 |
29 | sourceCompatibility = 11
30 | targetCompatibility = 11
31 |
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/build.gradle:
--------------------------------------------------------------------------------
1 | plugins{
2 | id 'java'
3 | id 'io.freefair.aspectj.post-compile-weaving' version '6.6.2'
4 | }
5 |
6 | repositories {
7 | mavenCentral()
8 | }
9 |
10 | // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests
11 | test {
12 | environment "LAMBDA_TASK_ROOT", "handler"
13 | }
14 |
15 | dependencies {
16 | aspect 'software.amazon.lambda:powertools-logging:1.12.0'
17 | aspect 'software.amazon.lambda:powertools-tracing:1.12.0'
18 | aspect 'software.amazon.lambda:powertools-metrics:1.12.0'
19 |
20 | implementation 'com.amazonaws:aws-lambda-java-core:1.2.1'
21 | implementation 'com.amazonaws:aws-lambda-java-events:3.11.0'
22 |
23 | implementation 'org.apache.logging.log4j:log4j-api:2.17.2'
24 | implementation 'org.apache.logging.log4j:log4j-core:2.19.0'
25 |
26 | testImplementation 'junit:junit:4.13.2'
27 | }
28 |
29 | sourceCompatibility = 1.8
30 | targetCompatibility = 1.8
31 |
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/build.gradle:
--------------------------------------------------------------------------------
1 | plugins{
2 | id 'java'
3 | id 'io.freefair.aspectj.post-compile-weaving' version '6.6.2'
4 | }
5 |
6 | repositories {
7 | mavenCentral()
8 | }
9 |
10 | // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests
11 | test {
12 | environment "LAMBDA_TASK_ROOT", "handler"
13 | }
14 |
15 | dependencies {
16 | aspect 'software.amazon.lambda:powertools-logging:1.12.0'
17 | aspect 'software.amazon.lambda:powertools-tracing:1.12.0'
18 | aspect 'software.amazon.lambda:powertools-metrics:1.12.0'
19 |
20 | implementation 'com.amazonaws:aws-lambda-java-core:1.2.1'
21 | implementation 'com.amazonaws:aws-lambda-java-events:3.11.0'
22 |
23 | implementation 'org.apache.logging.log4j:log4j-api:2.17.2'
24 | implementation 'org.apache.logging.log4j:log4j-core:2.19.0'
25 |
26 | testImplementation 'junit:junit:4.13.2'
27 | }
28 |
29 | sourceCompatibility = 1.8
30 | targetCompatibility = 1.8
31 |
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/test/java/helloworld/AppTest.java:
--------------------------------------------------------------------------------
1 | package helloworld;
2 |
3 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
4 | import com.amazonaws.xray.AWSXRay;
5 | import org.junit.After;
6 | import org.junit.Before;
7 | import org.junit.Test;
8 |
9 | import static org.junit.Assert.*;
10 |
11 | public class AppTest {
12 |
13 | @Before
14 | public void setup() {
15 | if(null == System.getenv("LAMBDA_TASK_ROOT")) {
16 | AWSXRay.beginSegment("test");
17 | }
18 | }
19 |
20 | @After
21 | public void tearDown() {
22 | if (AWSXRay.getCurrentSubsegmentOptional().isPresent()) {
23 | AWSXRay.endSubsegment();
24 | }
25 |
26 | if(null == System.getenv("LAMBDA_TASK_ROOT")) {
27 | AWSXRay.endSegment();
28 | }
29 | }
30 |
31 | @Test
32 | public void successfulResponse() {
33 | App app = new App();
34 | APIGatewayProxyResponseEvent result = app.handleRequest(null, null);
35 | assertEquals(result.getStatusCode().intValue(), 200);
36 | assertEquals(result.getHeaders().get("Content-Type"), "application/json");
37 | String content = result.getBody();
38 | assertNotNull(content);
39 | assertTrue(content.contains("\"message\""));
40 | assertTrue(content.contains("\"hello world\""));
41 | assertTrue(content.contains("\"location\""));
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/hooks/post_gen_project.py:
--------------------------------------------------------------------------------
1 | from __future__ import print_function
2 | from cookiecutter.main import cookiecutter
3 |
4 | import os
5 | import shutil
6 |
7 |
8 | TERMINATOR = "\x1b[0m"
9 | INFO = "\x1b[1;33m [INFO]: "
10 | SUCCESS = "\x1b[1;32m [SUCCESS]: "
11 | HINT = "\x1b[3;33m"
12 |
13 | def main():
14 |
15 | project_name = "{{ cookiecutter.project_name }}"
16 | project_slug = "{{ cookiecutter.project_slug }}"
17 |
18 | templates_repo = "{{ cookiecutter._templates_repo }}"
19 | template_dir = os.path.join("templates", "{{ cookiecutter.runtime }}", "cookiecutter-aws-sam-hello-powertools-java-{{ cookiecutter.dependency_manager.lower() }}")
20 |
21 | cookiecutter( templates_repo,
22 | directory=template_dir,
23 | no_input=True,
24 | output_dir="..",
25 | overwrite_if_exists=True,
26 | extra_context={
27 | "project_name": project_name,
28 | "project_slug": project_slug
29 | }
30 | )
31 |
32 | print(SUCCESS +
33 | "Project initialized successfully! You can now jump to {} folder".
34 | format(project_slug) + TERMINATOR)
35 | print(INFO +
36 | "{}/README.md contains instructions on how to proceed.".
37 | format(project_slug) + TERMINATOR)
38 |
39 | if __name__ == '__main__':
40 | main()
41 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Cookiecutter SAM for Lambda functions with AWS Lambda Powertools Java
2 |
3 | This is a [Cookiecutter](https://github.com/cookiecutter/cookiecutter) template to create a Serverless App based on Serverless Application Model (SAM) and Java with [Lambda Powertools Java](https://github.com/awslabs/aws-lambda-powertools-java).
4 |
5 | It is important to note that you should not try to `git clone` this project but use `SAM` CLI instead as ``{{cookiecutter.project_slug}}`` will be rendered based on your input and therefore all variables and files will be rendered properly.
6 |
7 | ## Usage
8 |
9 | Generate a new SAM based Serverless App: `sam init --location gh:aws-samples/cookiecutter-aws-sam-powertools-java`
10 |
11 | You'll be prompted a few questions to help this cookiecutter template to scaffold this project and after its completed you should see a new folder at your current path with the name of the project you gave as input.
12 |
13 | ## Options
14 |
15 | Option | Description
16 | ------------------------------------------------- | ---------------------------------------------------------------------------------
17 | `runtime` | You can choose the target runtime among available [Lambda Java runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html)
18 | `dependency_manager` | You can choose between Maven and Gradle to manage dependencies for the generated project
19 |
20 | # Credits
21 |
22 | * This project has been generated with [Cookiecutter](https://github.com/cookiecutter/cookiecutter)
23 |
24 | License
25 | -------
26 |
27 | This project is licensed under the terms of the [MIT License with no attribution](/LICENSE)
28 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "maven"
4 | directory: "/templates/java8/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction"
5 | schedule:
6 | interval: "daily"
7 | labels:
8 | - "maven"
9 | - "dependencies"
10 | - package-ecosystem: "maven"
11 | directory: "/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction"
12 | schedule:
13 | interval: "daily"
14 | labels:
15 | - "maven"
16 | - "dependencies"
17 | - package-ecosystem: "maven"
18 | directory: "/templates/java11/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction"
19 | schedule:
20 | interval: "daily"
21 | labels:
22 | - "maven"
23 | - "dependencies"
24 | - package-ecosystem: "gradle"
25 | directory: "/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction"
26 | schedule:
27 | interval: "daily"
28 | labels:
29 | - "gradle"
30 | - "dependencies"
31 | - package-ecosystem: "gradle"
32 | directory: "/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction"
33 | schedule:
34 | interval: "daily"
35 | labels:
36 | - "gradle"
37 | - "dependencies"
38 | - package-ecosystem: "gradle"
39 | directory: "/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction"
40 | schedule:
41 | interval: "daily"
42 | labels:
43 | - "gradle"
44 | - "dependencies"
45 |
46 |
--------------------------------------------------------------------------------
/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "java8": [
3 | {
4 | "directory": "templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle",
5 | "displayName": "Hello World Example with Lambda Powertools: Gradle",
6 | "dependencyManager": "gradle",
7 | "appTemplate": "powertools-hello-world",
8 | "javaVersion": "1.8"
9 | },
10 | {
11 | "directory": "templates/java8/cookiecutter-aws-sam-hello-powertools-java-maven",
12 | "displayName": "Hello World Example with Lambda Powertools: Maven",
13 | "dependencyManager": "maven",
14 | "appTemplate": "powertools-hello-world",
15 | "javaVersion": "1.8"
16 | }
17 | ],
18 | "java8.al2": [
19 | {
20 | "directory": "templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle",
21 | "displayName": "Hello World Example with Lambda Powertools: Gradle",
22 | "dependencyManager": "gradle",
23 | "appTemplate": "powertools-hello-world",
24 | "javaVersion": "1.8"
25 | },
26 | {
27 | "directory": "templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-maven",
28 | "displayName": "Hello World Example with Lambda Powertools: Maven",
29 | "dependencyManager": "maven",
30 | "appTemplate": "powertools-hello-world",
31 | "javaVersion": "1.8"
32 | }
33 | ],
34 | "java11": [
35 | {
36 | "directory": "templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle",
37 | "displayName": "Hello World Example with Lambda Powertools: Gradle",
38 | "dependencyManager": "gradle",
39 | "appTemplate": "powertools-hello-world",
40 | "javaVersion": "11"
41 | },
42 | {
43 | "directory": "templates/java11/cookiecutter-aws-sam-hello-powertools-java-maven",
44 | "displayName": "Hello World Example with Lambda Powertools: Maven",
45 | "dependencyManager": "maven",
46 | "appTemplate": "powertools-hello-world",
47 | "javaVersion": "11"
48 | }
49 | ]
50 | }
--------------------------------------------------------------------------------
/.github/workflows/auto-merge.yml:
--------------------------------------------------------------------------------
1 | name: Auto merge if dependabot PR
2 |
3 | on:
4 | workflow_run:
5 | workflows: ["Build"]
6 | types: [completed]
7 |
8 | jobs:
9 | merge-me:
10 | name: Merge me!
11 | runs-on: ubuntu-latest
12 | if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' && github.actor == 'dependabot[bot]'
13 | steps:
14 | - name: 'Download artifact'
15 | uses: actions/github-script@v3.1.0
16 | with:
17 | script: |
18 | var artifacts = await github.actions.listWorkflowRunArtifacts({
19 | owner: context.repo.owner,
20 | repo: context.repo.repo,
21 | run_id: ${{github.event.workflow_run.id }},
22 | });
23 | var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
24 | return artifact.name == "pr"
25 | })[0];
26 | var download = await github.actions.downloadArtifact({
27 | owner: context.repo.owner,
28 | repo: context.repo.repo,
29 | artifact_id: matchArtifact.id,
30 | archive_format: 'zip',
31 | });
32 | var fs = require('fs');
33 | fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
34 | - run: unzip pr.zip
35 | - name: Merge me!
36 | uses: actions/github-script@v3
37 | with:
38 | script: |
39 | var fs = require('fs');
40 | var issue_number = Number(fs.readFileSync('./NR'));
41 |
42 | github.pulls.createReview({
43 | owner: context.payload.repository.owner.login,
44 | repo: context.payload.repository.name,
45 | pull_number: issue_number,
46 | event: 'APPROVE'
47 | })
48 | github.pulls.merge({
49 | owner: context.payload.repository.owner.login,
50 | repo: context.payload.repository.name,
51 | pull_number: issue_number,
52 | merge_method: 'squash'
53 | })
54 | github-token: ${{ secrets.AUTOMERGE }}
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: Build
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - main
7 | paths:
8 | - 'manifest.json'
9 | - 'templates/**'
10 | - '.github/workflows/**'
11 | push:
12 | branches:
13 | - main
14 | paths:
15 | - 'manifest.json'
16 | - 'templates/**'
17 | - '.github/workflows/**'
18 |
19 | jobs:
20 | prepare:
21 | runs-on: ubuntu-latest
22 | outputs:
23 | matrix: ${{ steps.set-matrix.outputs.matrix }}
24 | steps:
25 | - uses: actions/checkout@v2
26 | - id: set-matrix
27 | run: |
28 | JSON=$(cat ./manifest.json | jq [.[][]])
29 | JSON="${JSON//'%'/'%25'}"
30 | JSON="{\"include\":$JSON}"
31 | JSON="${JSON//$'\n'/'%0A'}"
32 | JSON="${JSON//$'\r'/'%0D'}"
33 | echo $JSON
34 | echo "-----------------------"
35 | echo "::set-output name=matrix::$JSON"
36 | build:
37 | needs: prepare
38 | runs-on: ubuntu-latest
39 | strategy:
40 | matrix: ${{fromJson(needs.prepare.outputs.matrix)}}
41 | steps:
42 | - uses: actions/checkout@v2
43 | - name: Setup java
44 | uses: actions/setup-java@v1
45 | with:
46 | java-version: ${{ matrix.javaVersion }}
47 | - name: Build with Maven
48 | if: ${{ matrix.dependencyManager == 'maven' }}
49 | run: mvn -B package --file ${{ matrix.directory }}/"{{ cookiecutter.project_slug }}"/HelloWorldFunction/pom.xml
50 | - name: Build with Gradle
51 | if: ${{ matrix.dependencyManager == 'gradle' }}
52 | run: |
53 | cd ./${{ matrix.directory }}/"{{ cookiecutter.project_slug }}"/HelloWorldFunction/
54 | ./gradlew build
55 |
56 | savepr:
57 | runs-on: ubuntu-latest
58 | name: Save PR number if running on PR by dependabot
59 | if: github.actor == 'dependabot[bot]'
60 | steps:
61 | - name: Create Directory and save issue
62 | run: |
63 | mkdir -p ./pr
64 | echo ${{ github.event.number }}
65 | echo ${{ github.event.number }} > ./pr/NR
66 | - uses: actions/upload-artifact@v2
67 | name: Updload artifact
68 | with:
69 | name: pr
70 | path: pr/
71 |
72 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/events/event.json:
--------------------------------------------------------------------------------
1 | {
2 | "body": "{\"message\": \"hello world\"}",
3 | "resource": "/{proxy+}",
4 | "path": "/path/to/resource",
5 | "httpMethod": "POST",
6 | "isBase64Encoded": false,
7 | "queryStringParameters": {
8 | "foo": "bar"
9 | },
10 | "pathParameters": {
11 | "proxy": "/path/to/resource"
12 | },
13 | "stageVariables": {
14 | "baz": "qux"
15 | },
16 | "headers": {
17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
18 | "Accept-Encoding": "gzip, deflate, sdch",
19 | "Accept-Language": "en-US,en;q=0.8",
20 | "Cache-Control": "max-age=0",
21 | "CloudFront-Forwarded-Proto": "https",
22 | "CloudFront-Is-Desktop-Viewer": "true",
23 | "CloudFront-Is-Mobile-Viewer": "false",
24 | "CloudFront-Is-SmartTV-Viewer": "false",
25 | "CloudFront-Is-Tablet-Viewer": "false",
26 | "CloudFront-Viewer-Country": "US",
27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com",
28 | "Upgrade-Insecure-Requests": "1",
29 | "User-Agent": "Custom User Agent String",
30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)",
31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==",
32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2",
33 | "X-Forwarded-Port": "443",
34 | "X-Forwarded-Proto": "https"
35 | },
36 | "requestContext": {
37 | "accountId": "123456789012",
38 | "resourceId": "123456",
39 | "stage": "prod",
40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
41 | "requestTime": "09/Apr/2015:12:34:56 +0000",
42 | "requestTimeEpoch": 1428582896000,
43 | "identity": {
44 | "cognitoIdentityPoolId": null,
45 | "accountId": null,
46 | "cognitoIdentityId": null,
47 | "caller": null,
48 | "accessKey": null,
49 | "sourceIp": "127.0.0.1",
50 | "cognitoAuthenticationType": null,
51 | "cognitoAuthenticationProvider": null,
52 | "userArn": null,
53 | "userAgent": "Custom User Agent String",
54 | "user": null
55 | },
56 | "path": "/prod/path/to/resource",
57 | "resourcePath": "/{proxy+}",
58 | "httpMethod": "POST",
59 | "apiId": "1234567890",
60 | "protocol": "HTTP/1.1"
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/events/event.json:
--------------------------------------------------------------------------------
1 | {
2 | "body": "{\"message\": \"hello world\"}",
3 | "resource": "/{proxy+}",
4 | "path": "/path/to/resource",
5 | "httpMethod": "POST",
6 | "isBase64Encoded": false,
7 | "queryStringParameters": {
8 | "foo": "bar"
9 | },
10 | "pathParameters": {
11 | "proxy": "/path/to/resource"
12 | },
13 | "stageVariables": {
14 | "baz": "qux"
15 | },
16 | "headers": {
17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
18 | "Accept-Encoding": "gzip, deflate, sdch",
19 | "Accept-Language": "en-US,en;q=0.8",
20 | "Cache-Control": "max-age=0",
21 | "CloudFront-Forwarded-Proto": "https",
22 | "CloudFront-Is-Desktop-Viewer": "true",
23 | "CloudFront-Is-Mobile-Viewer": "false",
24 | "CloudFront-Is-SmartTV-Viewer": "false",
25 | "CloudFront-Is-Tablet-Viewer": "false",
26 | "CloudFront-Viewer-Country": "US",
27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com",
28 | "Upgrade-Insecure-Requests": "1",
29 | "User-Agent": "Custom User Agent String",
30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)",
31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==",
32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2",
33 | "X-Forwarded-Port": "443",
34 | "X-Forwarded-Proto": "https"
35 | },
36 | "requestContext": {
37 | "accountId": "123456789012",
38 | "resourceId": "123456",
39 | "stage": "prod",
40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
41 | "requestTime": "09/Apr/2015:12:34:56 +0000",
42 | "requestTimeEpoch": 1428582896000,
43 | "identity": {
44 | "cognitoIdentityPoolId": null,
45 | "accountId": null,
46 | "cognitoIdentityId": null,
47 | "caller": null,
48 | "accessKey": null,
49 | "sourceIp": "127.0.0.1",
50 | "cognitoAuthenticationType": null,
51 | "cognitoAuthenticationProvider": null,
52 | "userArn": null,
53 | "userAgent": "Custom User Agent String",
54 | "user": null
55 | },
56 | "path": "/prod/path/to/resource",
57 | "resourcePath": "/{proxy+}",
58 | "httpMethod": "POST",
59 | "apiId": "1234567890",
60 | "protocol": "HTTP/1.1"
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/events/event.json:
--------------------------------------------------------------------------------
1 | {
2 | "body": "{\"message\": \"hello world\"}",
3 | "resource": "/{proxy+}",
4 | "path": "/path/to/resource",
5 | "httpMethod": "POST",
6 | "isBase64Encoded": false,
7 | "queryStringParameters": {
8 | "foo": "bar"
9 | },
10 | "pathParameters": {
11 | "proxy": "/path/to/resource"
12 | },
13 | "stageVariables": {
14 | "baz": "qux"
15 | },
16 | "headers": {
17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
18 | "Accept-Encoding": "gzip, deflate, sdch",
19 | "Accept-Language": "en-US,en;q=0.8",
20 | "Cache-Control": "max-age=0",
21 | "CloudFront-Forwarded-Proto": "https",
22 | "CloudFront-Is-Desktop-Viewer": "true",
23 | "CloudFront-Is-Mobile-Viewer": "false",
24 | "CloudFront-Is-SmartTV-Viewer": "false",
25 | "CloudFront-Is-Tablet-Viewer": "false",
26 | "CloudFront-Viewer-Country": "US",
27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com",
28 | "Upgrade-Insecure-Requests": "1",
29 | "User-Agent": "Custom User Agent String",
30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)",
31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==",
32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2",
33 | "X-Forwarded-Port": "443",
34 | "X-Forwarded-Proto": "https"
35 | },
36 | "requestContext": {
37 | "accountId": "123456789012",
38 | "resourceId": "123456",
39 | "stage": "prod",
40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
41 | "requestTime": "09/Apr/2015:12:34:56 +0000",
42 | "requestTimeEpoch": 1428582896000,
43 | "identity": {
44 | "cognitoIdentityPoolId": null,
45 | "accountId": null,
46 | "cognitoIdentityId": null,
47 | "caller": null,
48 | "accessKey": null,
49 | "sourceIp": "127.0.0.1",
50 | "cognitoAuthenticationType": null,
51 | "cognitoAuthenticationProvider": null,
52 | "userArn": null,
53 | "userAgent": "Custom User Agent String",
54 | "user": null
55 | },
56 | "path": "/prod/path/to/resource",
57 | "resourcePath": "/{proxy+}",
58 | "httpMethod": "POST",
59 | "apiId": "1234567890",
60 | "protocol": "HTTP/1.1"
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/events/event.json:
--------------------------------------------------------------------------------
1 | {
2 | "body": "{\"message\": \"hello world\"}",
3 | "resource": "/{proxy+}",
4 | "path": "/path/to/resource",
5 | "httpMethod": "POST",
6 | "isBase64Encoded": false,
7 | "queryStringParameters": {
8 | "foo": "bar"
9 | },
10 | "pathParameters": {
11 | "proxy": "/path/to/resource"
12 | },
13 | "stageVariables": {
14 | "baz": "qux"
15 | },
16 | "headers": {
17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
18 | "Accept-Encoding": "gzip, deflate, sdch",
19 | "Accept-Language": "en-US,en;q=0.8",
20 | "Cache-Control": "max-age=0",
21 | "CloudFront-Forwarded-Proto": "https",
22 | "CloudFront-Is-Desktop-Viewer": "true",
23 | "CloudFront-Is-Mobile-Viewer": "false",
24 | "CloudFront-Is-SmartTV-Viewer": "false",
25 | "CloudFront-Is-Tablet-Viewer": "false",
26 | "CloudFront-Viewer-Country": "US",
27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com",
28 | "Upgrade-Insecure-Requests": "1",
29 | "User-Agent": "Custom User Agent String",
30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)",
31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==",
32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2",
33 | "X-Forwarded-Port": "443",
34 | "X-Forwarded-Proto": "https"
35 | },
36 | "requestContext": {
37 | "accountId": "123456789012",
38 | "resourceId": "123456",
39 | "stage": "prod",
40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
41 | "requestTime": "09/Apr/2015:12:34:56 +0000",
42 | "requestTimeEpoch": 1428582896000,
43 | "identity": {
44 | "cognitoIdentityPoolId": null,
45 | "accountId": null,
46 | "cognitoIdentityId": null,
47 | "caller": null,
48 | "accessKey": null,
49 | "sourceIp": "127.0.0.1",
50 | "cognitoAuthenticationType": null,
51 | "cognitoAuthenticationProvider": null,
52 | "userArn": null,
53 | "userAgent": "Custom User Agent String",
54 | "user": null
55 | },
56 | "path": "/prod/path/to/resource",
57 | "resourcePath": "/{proxy+}",
58 | "httpMethod": "POST",
59 | "apiId": "1234567890",
60 | "protocol": "HTTP/1.1"
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/events/event.json:
--------------------------------------------------------------------------------
1 | {
2 | "body": "{\"message\": \"hello world\"}",
3 | "resource": "/{proxy+}",
4 | "path": "/path/to/resource",
5 | "httpMethod": "POST",
6 | "isBase64Encoded": false,
7 | "queryStringParameters": {
8 | "foo": "bar"
9 | },
10 | "pathParameters": {
11 | "proxy": "/path/to/resource"
12 | },
13 | "stageVariables": {
14 | "baz": "qux"
15 | },
16 | "headers": {
17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
18 | "Accept-Encoding": "gzip, deflate, sdch",
19 | "Accept-Language": "en-US,en;q=0.8",
20 | "Cache-Control": "max-age=0",
21 | "CloudFront-Forwarded-Proto": "https",
22 | "CloudFront-Is-Desktop-Viewer": "true",
23 | "CloudFront-Is-Mobile-Viewer": "false",
24 | "CloudFront-Is-SmartTV-Viewer": "false",
25 | "CloudFront-Is-Tablet-Viewer": "false",
26 | "CloudFront-Viewer-Country": "US",
27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com",
28 | "Upgrade-Insecure-Requests": "1",
29 | "User-Agent": "Custom User Agent String",
30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)",
31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==",
32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2",
33 | "X-Forwarded-Port": "443",
34 | "X-Forwarded-Proto": "https"
35 | },
36 | "requestContext": {
37 | "accountId": "123456789012",
38 | "resourceId": "123456",
39 | "stage": "prod",
40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
41 | "requestTime": "09/Apr/2015:12:34:56 +0000",
42 | "requestTimeEpoch": 1428582896000,
43 | "identity": {
44 | "cognitoIdentityPoolId": null,
45 | "accountId": null,
46 | "cognitoIdentityId": null,
47 | "caller": null,
48 | "accessKey": null,
49 | "sourceIp": "127.0.0.1",
50 | "cognitoAuthenticationType": null,
51 | "cognitoAuthenticationProvider": null,
52 | "userArn": null,
53 | "userAgent": "Custom User Agent String",
54 | "user": null
55 | },
56 | "path": "/prod/path/to/resource",
57 | "resourcePath": "/{proxy+}",
58 | "httpMethod": "POST",
59 | "apiId": "1234567890",
60 | "protocol": "HTTP/1.1"
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/events/event.json:
--------------------------------------------------------------------------------
1 | {
2 | "body": "{\"message\": \"hello world\"}",
3 | "resource": "/{proxy+}",
4 | "path": "/path/to/resource",
5 | "httpMethod": "POST",
6 | "isBase64Encoded": false,
7 | "queryStringParameters": {
8 | "foo": "bar"
9 | },
10 | "pathParameters": {
11 | "proxy": "/path/to/resource"
12 | },
13 | "stageVariables": {
14 | "baz": "qux"
15 | },
16 | "headers": {
17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
18 | "Accept-Encoding": "gzip, deflate, sdch",
19 | "Accept-Language": "en-US,en;q=0.8",
20 | "Cache-Control": "max-age=0",
21 | "CloudFront-Forwarded-Proto": "https",
22 | "CloudFront-Is-Desktop-Viewer": "true",
23 | "CloudFront-Is-Mobile-Viewer": "false",
24 | "CloudFront-Is-SmartTV-Viewer": "false",
25 | "CloudFront-Is-Tablet-Viewer": "false",
26 | "CloudFront-Viewer-Country": "US",
27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com",
28 | "Upgrade-Insecure-Requests": "1",
29 | "User-Agent": "Custom User Agent String",
30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)",
31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==",
32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2",
33 | "X-Forwarded-Port": "443",
34 | "X-Forwarded-Proto": "https"
35 | },
36 | "requestContext": {
37 | "accountId": "123456789012",
38 | "resourceId": "123456",
39 | "stage": "prod",
40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
41 | "requestTime": "09/Apr/2015:12:34:56 +0000",
42 | "requestTimeEpoch": 1428582896000,
43 | "identity": {
44 | "cognitoIdentityPoolId": null,
45 | "accountId": null,
46 | "cognitoIdentityId": null,
47 | "caller": null,
48 | "accessKey": null,
49 | "sourceIp": "127.0.0.1",
50 | "cognitoAuthenticationType": null,
51 | "cognitoAuthenticationProvider": null,
52 | "userArn": null,
53 | "userAgent": "Custom User Agent String",
54 | "user": null
55 | },
56 | "path": "/prod/path/to/resource",
57 | "resourcePath": "/{proxy+}",
58 | "httpMethod": "POST",
59 | "apiId": "1234567890",
60 | "protocol": "HTTP/1.1"
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/template.yaml:
--------------------------------------------------------------------------------
1 | AWSTemplateFormatVersion: '2010-09-09'
2 | Transform: AWS::Serverless-2016-10-31
3 | Description: >
4 | {{ cookiecutter.project_name }}
5 |
6 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
7 | Globals:
8 | Function:
9 | Timeout: 20
10 | Runtime: java11
11 | MemorySize: 512
12 | Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html
13 | Environment:
14 | Variables:
15 | # Powertools env vars: https://awslabs.github.io/aws-lambda-powertools-python/#environment-variables
16 | POWERTOOLS_LOG_LEVEL: INFO
17 | POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1
18 | POWERTOOLS_LOGGER_LOG_EVENT: true
19 | POWERTOOLS_METRICS_NAMESPACE: {{ cookiecutter.project_slug }}
20 |
21 | Resources:
22 | HelloWorldFunction:
23 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
24 | Properties:
25 | CodeUri: HelloWorldFunction
26 | Handler: helloworld.App::handleRequest
27 | Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
28 | Variables:
29 | POWERTOOLS_SERVICE_NAME: hello
30 | Events:
31 | HelloWorld:
32 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
33 | Properties:
34 | Path: /hello
35 | Method: get
36 |
37 | Outputs:
38 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
39 | # Find out more about other implicit resources you can reference within SAM
40 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
41 | HelloWorldApi:
42 | Description: "API Gateway endpoint URL for Prod stage for Hello World function"
43 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
44 | HelloWorldFunction:
45 | Description: "Hello World Lambda Function ARN"
46 | Value: !GetAtt HelloWorldFunction.Arn
47 | HelloWorldFunctionIamRole:
48 | Description: "Implicit IAM Role created for Hello World function"
49 | Value: !GetAtt HelloWorldFunctionRole.Arn
50 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/template.yaml:
--------------------------------------------------------------------------------
1 | AWSTemplateFormatVersion: '2010-09-09'
2 | Transform: AWS::Serverless-2016-10-31
3 | Description: >
4 | {{ cookiecutter.project_name }}
5 |
6 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
7 | Globals:
8 | Function:
9 | Timeout: 20
10 | Runtime: java11
11 | MemorySize: 512
12 | Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html
13 | Environment:
14 | Variables:
15 | # Powertools env vars: https://awslabs.github.io/aws-lambda-powertools-python/#environment-variables
16 | POWERTOOLS_LOG_LEVEL: INFO
17 | POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1
18 | POWERTOOLS_LOGGER_LOG_EVENT: true
19 | POWERTOOLS_METRICS_NAMESPACE: {{ cookiecutter.project_slug }}
20 |
21 | Resources:
22 | HelloWorldFunction:
23 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
24 | Properties:
25 | CodeUri: HelloWorldFunction
26 | Handler: helloworld.App::handleRequest
27 | Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
28 | Variables:
29 | POWERTOOLS_SERVICE_NAME: hello
30 | Events:
31 | HelloWorld:
32 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
33 | Properties:
34 | Path: /hello
35 | Method: get
36 |
37 | Outputs:
38 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
39 | # Find out more about other implicit resources you can reference within SAM
40 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
41 | HelloWorldApi:
42 | Description: "API Gateway endpoint URL for Prod stage for Hello World function"
43 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
44 | HelloWorldFunction:
45 | Description: "Hello World Lambda Function ARN"
46 | Value: !GetAtt HelloWorldFunction.Arn
47 | HelloWorldFunctionIamRole:
48 | Description: "Implicit IAM Role created for Hello World function"
49 | Value: !GetAtt HelloWorldFunctionRole.Arn
50 |
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/template.yaml:
--------------------------------------------------------------------------------
1 | AWSTemplateFormatVersion: '2010-09-09'
2 | Transform: AWS::Serverless-2016-10-31
3 | Description: >
4 | {{ cookiecutter.project_name }}
5 |
6 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
7 | Globals:
8 | Function:
9 | Timeout: 20
10 | Runtime: java8
11 | MemorySize: 512
12 | Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html
13 | Environment:
14 | Variables:
15 | # Powertools env vars: https://awslabs.github.io/aws-lambda-powertools-python/#environment-variables
16 | POWERTOOLS_LOG_LEVEL: INFO
17 | POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1
18 | POWERTOOLS_LOGGER_LOG_EVENT: true
19 | POWERTOOLS_METRICS_NAMESPACE: {{ cookiecutter.project_slug }}
20 |
21 | Resources:
22 | HelloWorldFunction:
23 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
24 | Properties:
25 | CodeUri: HelloWorldFunction
26 | Handler: helloworld.App::handleRequest
27 | Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
28 | Variables:
29 | POWERTOOLS_SERVICE_NAME: hello
30 | Events:
31 | HelloWorld:
32 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
33 | Properties:
34 | Path: /hello
35 | Method: get
36 |
37 | Outputs:
38 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
39 | # Find out more about other implicit resources you can reference within SAM
40 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
41 | HelloWorldApi:
42 | Description: "API Gateway endpoint URL for Prod stage for Hello World function"
43 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
44 | HelloWorldFunction:
45 | Description: "Hello World Lambda Function ARN"
46 | Value: !GetAtt HelloWorldFunction.Arn
47 | HelloWorldFunctionIamRole:
48 | Description: "Implicit IAM Role created for Hello World function"
49 | Value: !GetAtt HelloWorldFunctionRole.Arn
50 |
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/template.yaml:
--------------------------------------------------------------------------------
1 | AWSTemplateFormatVersion: '2010-09-09'
2 | Transform: AWS::Serverless-2016-10-31
3 | Description: >
4 | {{ cookiecutter.project_name }}
5 |
6 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
7 | Globals:
8 | Function:
9 | Timeout: 20
10 | Runtime: java8
11 | MemorySize: 512
12 | Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html
13 | Environment:
14 | Variables:
15 | # Powertools env vars: https://awslabs.github.io/aws-lambda-powertools-python/#environment-variables
16 | POWERTOOLS_LOG_LEVEL: INFO
17 | POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1
18 | POWERTOOLS_LOGGER_LOG_EVENT: true
19 | POWERTOOLS_METRICS_NAMESPACE: {{ cookiecutter.project_slug }}
20 |
21 | Resources:
22 | HelloWorldFunction:
23 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
24 | Properties:
25 | CodeUri: HelloWorldFunction
26 | Handler: helloworld.App::handleRequest
27 | Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
28 | Variables:
29 | POWERTOOLS_SERVICE_NAME: hello
30 | Events:
31 | HelloWorld:
32 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
33 | Properties:
34 | Path: /hello
35 | Method: get
36 |
37 | Outputs:
38 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
39 | # Find out more about other implicit resources you can reference within SAM
40 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
41 | HelloWorldApi:
42 | Description: "API Gateway endpoint URL for Prod stage for Hello World function"
43 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
44 | HelloWorldFunction:
45 | Description: "Hello World Lambda Function ARN"
46 | Value: !GetAtt HelloWorldFunction.Arn
47 | HelloWorldFunctionIamRole:
48 | Description: "Implicit IAM Role created for Hello World function"
49 | Value: !GetAtt HelloWorldFunctionRole.Arn
50 |
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/template.yaml:
--------------------------------------------------------------------------------
1 | AWSTemplateFormatVersion: '2010-09-09'
2 | Transform: AWS::Serverless-2016-10-31
3 | Description: >
4 | {{ cookiecutter.project_name }}
5 |
6 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
7 | Globals:
8 | Function:
9 | Timeout: 20
10 | Runtime: java8.al2
11 | MemorySize: 512
12 | Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html
13 | Environment:
14 | Variables:
15 | # Powertools env vars: https://awslabs.github.io/aws-lambda-powertools-python/#environment-variables
16 | POWERTOOLS_LOG_LEVEL: INFO
17 | POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1
18 | POWERTOOLS_LOGGER_LOG_EVENT: true
19 | POWERTOOLS_METRICS_NAMESPACE: {{ cookiecutter.project_slug }}
20 |
21 | Resources:
22 | HelloWorldFunction:
23 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
24 | Properties:
25 | CodeUri: HelloWorldFunction
26 | Handler: helloworld.App::handleRequest
27 | Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
28 | Variables:
29 | POWERTOOLS_SERVICE_NAME: hello
30 | Events:
31 | HelloWorld:
32 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
33 | Properties:
34 | Path: /hello
35 | Method: get
36 |
37 | Outputs:
38 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
39 | # Find out more about other implicit resources you can reference within SAM
40 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
41 | HelloWorldApi:
42 | Description: "API Gateway endpoint URL for Prod stage for Hello World function"
43 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
44 | HelloWorldFunction:
45 | Description: "Hello World Lambda Function ARN"
46 | Value: !GetAtt HelloWorldFunction.Arn
47 | HelloWorldFunctionIamRole:
48 | Description: "Implicit IAM Role created for Hello World function"
49 | Value: !GetAtt HelloWorldFunctionRole.Arn
50 |
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/template.yaml:
--------------------------------------------------------------------------------
1 | AWSTemplateFormatVersion: '2010-09-09'
2 | Transform: AWS::Serverless-2016-10-31
3 | Description: >
4 | {{ cookiecutter.project_name }}
5 |
6 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
7 | Globals:
8 | Function:
9 | Timeout: 20
10 | Runtime: java8.al2
11 | MemorySize: 512
12 | Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html
13 | Environment:
14 | Variables:
15 | # Powertools env vars: https://awslabs.github.io/aws-lambda-powertools-python/#environment-variables
16 | POWERTOOLS_LOG_LEVEL: INFO
17 | POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1
18 | POWERTOOLS_LOGGER_LOG_EVENT: true
19 | POWERTOOLS_METRICS_NAMESPACE: {{ cookiecutter.project_slug }}
20 |
21 | Resources:
22 | HelloWorldFunction:
23 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
24 | Properties:
25 | CodeUri: HelloWorldFunction
26 | Handler: helloworld.App::handleRequest
27 | Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
28 | Variables:
29 | POWERTOOLS_SERVICE_NAME: hello
30 | Events:
31 | HelloWorld:
32 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
33 | Properties:
34 | Path: /hello
35 | Method: get
36 |
37 | Outputs:
38 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
39 | # Find out more about other implicit resources you can reference within SAM
40 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
41 | HelloWorldApi:
42 | Description: "API Gateway endpoint URL for Prod stage for Hello World function"
43 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
44 | HelloWorldFunction:
45 | Description: "Hello World Lambda Function ARN"
46 | Value: !GetAtt HelloWorldFunction.Arn
47 | HelloWorldFunctionIamRole:
48 | Description: "Implicit IAM Role created for Hello World function"
49 | Value: !GetAtt HelloWorldFunctionRole.Arn
50 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/main/java/helloworld/App.java:
--------------------------------------------------------------------------------
1 | package helloworld;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.IOException;
5 | import java.io.InputStreamReader;
6 | import java.net.URL;
7 | import java.util.HashMap;
8 | import java.util.Map;
9 | import java.util.stream.Collectors;
10 |
11 | import com.amazonaws.services.lambda.runtime.Context;
12 | import com.amazonaws.services.lambda.runtime.RequestHandler;
13 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
14 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
15 | import org.apache.logging.log4j.LogManager;
16 | import org.apache.logging.log4j.Logger;
17 | import software.amazon.lambda.powertools.logging.Logging;
18 | import software.amazon.lambda.powertools.metrics.Metrics;
19 | import software.amazon.lambda.powertools.tracing.Tracing;
20 |
21 | import static software.amazon.lambda.powertools.tracing.CaptureMode.DISABLED;
22 |
23 | /**
24 | * Handler for requests to Lambda function.
25 | */
26 | public class App implements RequestHandler {
27 |
28 | Logger log = LogManager.getLogger();
29 |
30 | @Logging(logEvent = true)
31 | @Tracing(captureMode = DISABLED)
32 | @Metrics(captureColdStart = true)
33 | public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
34 | Map headers = new HashMap<>();
35 | headers.put("Content-Type", "application/json");
36 | headers.put("X-Custom-Header", "application/json");
37 |
38 | APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent()
39 | .withHeaders(headers);
40 | try {
41 | final String pageContents = this.getPageContents("https://checkip.amazonaws.com");
42 | String output = String.format("{ \"message\": \"hello world\", \"location\": \"%s\" }", pageContents);
43 |
44 | return response
45 | .withStatusCode(200)
46 | .withBody(output);
47 | } catch (IOException e) {
48 | return response
49 | .withBody("{}")
50 | .withStatusCode(500);
51 | }
52 | }
53 |
54 | @Tracing(namespace = "getPageContents")
55 | private String getPageContents(String address) throws IOException {
56 | log.info("Retrieving {}", address);
57 | URL url = new URL(address);
58 | try (BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()))) {
59 | return br.lines().collect(Collectors.joining(System.lineSeparator()));
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/main/java/helloworld/App.java:
--------------------------------------------------------------------------------
1 | package helloworld;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.IOException;
5 | import java.io.InputStreamReader;
6 | import java.net.URL;
7 | import java.util.HashMap;
8 | import java.util.Map;
9 | import java.util.stream.Collectors;
10 |
11 | import com.amazonaws.services.lambda.runtime.Context;
12 | import com.amazonaws.services.lambda.runtime.RequestHandler;
13 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
14 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
15 | import org.apache.logging.log4j.LogManager;
16 | import org.apache.logging.log4j.Logger;
17 | import software.amazon.lambda.powertools.logging.Logging;
18 | import software.amazon.lambda.powertools.metrics.Metrics;
19 | import software.amazon.lambda.powertools.tracing.Tracing;
20 |
21 | import static software.amazon.lambda.powertools.tracing.CaptureMode.DISABLED;
22 |
23 | /**
24 | * Handler for requests to Lambda function.
25 | */
26 | public class App implements RequestHandler {
27 |
28 | Logger log = LogManager.getLogger();
29 |
30 | @Logging(logEvent = true)
31 | @Tracing(captureMode = DISABLED)
32 | @Metrics(captureColdStart = true)
33 | public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
34 | Map headers = new HashMap<>();
35 | headers.put("Content-Type", "application/json");
36 | headers.put("X-Custom-Header", "application/json");
37 |
38 | APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent()
39 | .withHeaders(headers);
40 | try {
41 | final String pageContents = this.getPageContents("https://checkip.amazonaws.com");
42 | String output = String.format("{ \"message\": \"hello world\", \"location\": \"%s\" }", pageContents);
43 |
44 | return response
45 | .withStatusCode(200)
46 | .withBody(output);
47 | } catch (IOException e) {
48 | return response
49 | .withBody("{}")
50 | .withStatusCode(500);
51 | }
52 | }
53 |
54 | @Tracing(namespace = "getPageContents")
55 | private String getPageContents(String address) throws IOException {
56 | log.info("Retrieving {}", address);
57 | URL url = new URL(address);
58 | try (BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()))) {
59 | return br.lines().collect(Collectors.joining(System.lineSeparator()));
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/main/java/helloworld/App.java:
--------------------------------------------------------------------------------
1 | package helloworld;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.IOException;
5 | import java.io.InputStreamReader;
6 | import java.net.URL;
7 | import java.util.HashMap;
8 | import java.util.Map;
9 | import java.util.stream.Collectors;
10 |
11 | import com.amazonaws.services.lambda.runtime.Context;
12 | import com.amazonaws.services.lambda.runtime.RequestHandler;
13 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
14 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
15 | import org.apache.logging.log4j.LogManager;
16 | import org.apache.logging.log4j.Logger;
17 | import software.amazon.lambda.powertools.logging.Logging;
18 | import software.amazon.lambda.powertools.metrics.Metrics;
19 | import software.amazon.lambda.powertools.tracing.Tracing;
20 |
21 | import static software.amazon.lambda.powertools.tracing.CaptureMode.DISABLED;
22 |
23 | /**
24 | * Handler for requests to Lambda function.
25 | */
26 | public class App implements RequestHandler {
27 |
28 | Logger log = LogManager.getLogger();
29 |
30 | @Logging(logEvent = true)
31 | @Tracing(captureMode = DISABLED)
32 | @Metrics(captureColdStart = true)
33 | public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
34 | Map headers = new HashMap<>();
35 | headers.put("Content-Type", "application/json");
36 | headers.put("X-Custom-Header", "application/json");
37 |
38 | APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent()
39 | .withHeaders(headers);
40 | try {
41 | final String pageContents = this.getPageContents("https://checkip.amazonaws.com");
42 | String output = String.format("{ \"message\": \"hello world\", \"location\": \"%s\" }", pageContents);
43 |
44 | return response
45 | .withStatusCode(200)
46 | .withBody(output);
47 | } catch (IOException e) {
48 | return response
49 | .withBody("{}")
50 | .withStatusCode(500);
51 | }
52 | }
53 |
54 | @Tracing(namespace = "getPageContents")
55 | private String getPageContents(String address) throws IOException {
56 | log.info("Retrieving {}", address);
57 | URL url = new URL(address);
58 | try (BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()))) {
59 | return br.lines().collect(Collectors.joining(System.lineSeparator()));
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/main/java/helloworld/App.java:
--------------------------------------------------------------------------------
1 | package helloworld;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.IOException;
5 | import java.io.InputStreamReader;
6 | import java.net.URL;
7 | import java.util.HashMap;
8 | import java.util.Map;
9 | import java.util.stream.Collectors;
10 |
11 | import com.amazonaws.services.lambda.runtime.Context;
12 | import com.amazonaws.services.lambda.runtime.RequestHandler;
13 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
14 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
15 | import org.apache.logging.log4j.LogManager;
16 | import org.apache.logging.log4j.Logger;
17 | import software.amazon.lambda.powertools.logging.Logging;
18 | import software.amazon.lambda.powertools.metrics.Metrics;
19 | import software.amazon.lambda.powertools.tracing.Tracing;
20 |
21 | import static software.amazon.lambda.powertools.tracing.CaptureMode.DISABLED;
22 |
23 | /**
24 | * Handler for requests to Lambda function.
25 | */
26 | public class App implements RequestHandler {
27 |
28 | Logger log = LogManager.getLogger();
29 |
30 | @Logging(logEvent = true)
31 | @Tracing(captureMode = DISABLED)
32 | @Metrics(captureColdStart = true)
33 | public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
34 | Map headers = new HashMap<>();
35 | headers.put("Content-Type", "application/json");
36 | headers.put("X-Custom-Header", "application/json");
37 |
38 | APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent()
39 | .withHeaders(headers);
40 | try {
41 | final String pageContents = this.getPageContents("https://checkip.amazonaws.com");
42 | String output = String.format("{ \"message\": \"hello world\", \"location\": \"%s\" }", pageContents);
43 |
44 | return response
45 | .withStatusCode(200)
46 | .withBody(output);
47 | } catch (IOException e) {
48 | return response
49 | .withBody("{}")
50 | .withStatusCode(500);
51 | }
52 | }
53 |
54 | @Tracing(namespace = "getPageContents")
55 | private String getPageContents(String address) throws IOException {
56 | log.info("Retrieving {}", address);
57 | URL url = new URL(address);
58 | try (BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()))) {
59 | return br.lines().collect(Collectors.joining(System.lineSeparator()));
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/main/java/helloworld/App.java:
--------------------------------------------------------------------------------
1 | package helloworld;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.IOException;
5 | import java.io.InputStreamReader;
6 | import java.net.URL;
7 | import java.util.HashMap;
8 | import java.util.Map;
9 | import java.util.stream.Collectors;
10 |
11 | import com.amazonaws.services.lambda.runtime.Context;
12 | import com.amazonaws.services.lambda.runtime.RequestHandler;
13 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
14 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
15 | import org.apache.logging.log4j.LogManager;
16 | import org.apache.logging.log4j.Logger;
17 | import software.amazon.lambda.powertools.logging.Logging;
18 | import software.amazon.lambda.powertools.metrics.Metrics;
19 | import software.amazon.lambda.powertools.tracing.CaptureMode;
20 | import software.amazon.lambda.powertools.tracing.Tracing;
21 |
22 | import static software.amazon.lambda.powertools.tracing.CaptureMode.*;
23 |
24 | /**
25 | * Handler for requests to Lambda function.
26 | */
27 | public class App implements RequestHandler {
28 |
29 | Logger log = LogManager.getLogger();
30 |
31 | @Logging(logEvent = true)
32 | @Tracing(captureMode = DISABLED)
33 | @Metrics(captureColdStart = true)
34 | public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
35 | Map headers = new HashMap<>();
36 | headers.put("Content-Type", "application/json");
37 | headers.put("X-Custom-Header", "application/json");
38 |
39 | APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent()
40 | .withHeaders(headers);
41 | try {
42 | final String pageContents = this.getPageContents("https://checkip.amazonaws.com");
43 | String output = String.format("{ \"message\": \"hello world\", \"location\": \"%s\" }", pageContents);
44 |
45 | return response
46 | .withStatusCode(200)
47 | .withBody(output);
48 | } catch (IOException e) {
49 | return response
50 | .withBody("{}")
51 | .withStatusCode(500);
52 | }
53 | }
54 |
55 | @Tracing(namespace = "getPageContents")
56 | private String getPageContents(String address) throws IOException {
57 | log.info("Retrieving {}", address);
58 | URL url = new URL(address);
59 | try (BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()))) {
60 | return br.lines().collect(Collectors.joining(System.lineSeparator()));
61 | }
62 | }
63 | }
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction/src/main/java/helloworld/App.java:
--------------------------------------------------------------------------------
1 | package helloworld;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.IOException;
5 | import java.io.InputStreamReader;
6 | import java.net.URL;
7 | import java.util.HashMap;
8 | import java.util.Map;
9 | import java.util.stream.Collectors;
10 |
11 | import com.amazonaws.services.lambda.runtime.Context;
12 | import com.amazonaws.services.lambda.runtime.RequestHandler;
13 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
14 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
15 | import org.apache.logging.log4j.LogManager;
16 | import org.apache.logging.log4j.Logger;
17 | import software.amazon.lambda.powertools.logging.Logging;
18 | import software.amazon.lambda.powertools.metrics.Metrics;
19 | import software.amazon.lambda.powertools.tracing.CaptureMode;
20 | import software.amazon.lambda.powertools.tracing.Tracing;
21 |
22 | import static software.amazon.lambda.powertools.tracing.CaptureMode.*;
23 |
24 | /**
25 | * Handler for requests to Lambda function.
26 | */
27 | public class App implements RequestHandler {
28 |
29 | Logger log = LogManager.getLogger();
30 |
31 | @Logging(logEvent = true)
32 | @Tracing(captureMode = DISABLED)
33 | @Metrics(captureColdStart = true)
34 | public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
35 | Map headers = new HashMap<>();
36 | headers.put("Content-Type", "application/json");
37 | headers.put("X-Custom-Header", "application/json");
38 |
39 | APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent()
40 | .withHeaders(headers);
41 | try {
42 | final String pageContents = this.getPageContents("https://checkip.amazonaws.com");
43 | String output = String.format("{ \"message\": \"hello world\", \"location\": \"%s\" }", pageContents);
44 |
45 | return response
46 | .withStatusCode(200)
47 | .withBody(output);
48 | } catch (IOException e) {
49 | return response
50 | .withBody("{}")
51 | .withStatusCode(500);
52 | }
53 | }
54 |
55 | @Tracing(namespace = "getPageContents")
56 | private String getPageContents(String address) throws IOException {
57 | log.info("Retrieving {}", address);
58 | URL url = new URL(address);
59 | try (BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()))) {
60 | return br.lines().collect(Collectors.joining(System.lineSeparator()));
61 | }
62 | }
63 | }
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing Guidelines
2 |
3 | Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
4 | documentation, we greatly value feedback and contributions from our community.
5 |
6 | Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
7 | information to effectively respond to your bug report or contribution.
8 |
9 |
10 | ## Reporting Bugs/Feature Requests
11 |
12 | We welcome you to use the GitHub issue tracker to report bugs or suggest features.
13 |
14 | When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
15 | reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
16 |
17 | * A reproducible test case or series of steps
18 | * The version of our code being used
19 | * Any modifications you've made relevant to the bug
20 | * Anything unusual about your environment or deployment
21 |
22 |
23 | ## Contributing via Pull Requests
24 | Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
25 |
26 | 1. You are working against the latest source on the *main* branch.
27 | 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
28 | 3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
29 |
30 | To send us a pull request, please:
31 |
32 | 1. Fork the repository.
33 | 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
34 | 3. Ensure local tests pass.
35 | 4. Commit to your fork using clear commit messages.
36 | 5. Send us a pull request, answering any default questions in the pull request interface.
37 | 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
38 |
39 | GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
40 | [creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
41 |
42 |
43 | ## Finding contributions to work on
44 | Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
45 |
46 |
47 | ## Code of Conduct
48 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
49 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
50 | opensource-codeofconduct@amazon.com with any additional questions or comments.
51 |
52 |
53 | ## Security issue notifications
54 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
55 |
56 |
57 | ## Licensing
58 |
59 | See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
60 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto init
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto init
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :init
68 | @rem Get command-line arguments, handling Windows variants
69 |
70 | if not "%OS%" == "Windows_NT" goto win9xME_args
71 |
72 | :win9xME_args
73 | @rem Slurp the command line arguments.
74 | set CMD_LINE_ARGS=
75 | set _SKIP=2
76 |
77 | :win9xME_args_slurp
78 | if "x%~1" == "x" goto execute
79 |
80 | set CMD_LINE_ARGS=%*
81 |
82 | :execute
83 | @rem Setup the command line
84 |
85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
86 |
87 |
88 | @rem Execute Gradle
89 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
90 |
91 | :end
92 | @rem End local scope for the variables with windows NT shell
93 | if "%ERRORLEVEL%"=="0" goto mainEnd
94 |
95 | :fail
96 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
97 | rem the _cmd.exe /c_ return code!
98 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
99 | exit /b 1
100 |
101 | :mainEnd
102 | if "%OS%"=="Windows_NT" endlocal
103 |
104 | :omega
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto init
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto init
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :init
68 | @rem Get command-line arguments, handling Windows variants
69 |
70 | if not "%OS%" == "Windows_NT" goto win9xME_args
71 |
72 | :win9xME_args
73 | @rem Slurp the command line arguments.
74 | set CMD_LINE_ARGS=
75 | set _SKIP=2
76 |
77 | :win9xME_args_slurp
78 | if "x%~1" == "x" goto execute
79 |
80 | set CMD_LINE_ARGS=%*
81 |
82 | :execute
83 | @rem Setup the command line
84 |
85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
86 |
87 |
88 | @rem Execute Gradle
89 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
90 |
91 | :end
92 | @rem End local scope for the variables with windows NT shell
93 | if "%ERRORLEVEL%"=="0" goto mainEnd
94 |
95 | :fail
96 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
97 | rem the _cmd.exe /c_ return code!
98 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
99 | exit /b 1
100 |
101 | :mainEnd
102 | if "%OS%"=="Windows_NT" endlocal
103 |
104 | :omega
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto init
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto init
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :init
68 | @rem Get command-line arguments, handling Windows variants
69 |
70 | if not "%OS%" == "Windows_NT" goto win9xME_args
71 |
72 | :win9xME_args
73 | @rem Slurp the command line arguments.
74 | set CMD_LINE_ARGS=
75 | set _SKIP=2
76 |
77 | :win9xME_args_slurp
78 | if "x%~1" == "x" goto execute
79 |
80 | set CMD_LINE_ARGS=%*
81 |
82 | :execute
83 | @rem Setup the command line
84 |
85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
86 |
87 |
88 | @rem Execute Gradle
89 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
90 |
91 | :end
92 | @rem End local scope for the variables with windows NT shell
93 | if "%ERRORLEVEL%"=="0" goto mainEnd
94 |
95 | :fail
96 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
97 | rem the _cmd.exe /c_ return code!
98 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
99 | exit /b 1
100 |
101 | :mainEnd
102 | if "%OS%"=="Windows_NT" endlocal
103 |
104 | :omega
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | helloworld
5 | HelloWorld
6 | 1.0
7 | jar
8 | A sample Hello World created for SAM CLI.
9 |
10 | 11
11 | 11
12 | 2.17.2
13 | UTF-8
14 |
15 |
16 |
17 |
18 | software.amazon.lambda
19 | powertools-tracing
20 | 1.12.0
21 |
22 |
23 | software.amazon.lambda
24 | powertools-logging
25 | 1.12.0
26 |
27 |
28 | software.amazon.lambda
29 | powertools-metrics
30 | 1.12.0
31 |
32 |
33 | com.amazonaws
34 | aws-lambda-java-core
35 | 1.2.1
36 |
37 |
38 | com.amazonaws
39 | aws-lambda-java-events
40 | 3.11.0
41 |
42 |
43 | org.apache.logging.log4j
44 | log4j-core
45 | ${log4j.version}
46 |
47 |
48 | org.apache.logging.log4j
49 | log4j-api
50 | ${log4j.version}
51 |
52 |
53 |
54 | junit
55 | junit
56 | 4.13.2
57 | test
58 |
59 |
60 |
61 |
62 |
63 |
64 | org.codehaus.mojo
65 | aspectj-maven-plugin
66 | 1.14.0
67 |
68 | ${maven.compiler.source}
69 | ${maven.compiler.target}
70 | ${maven.compiler.target}
71 |
72 |
73 | software.amazon.lambda
74 | powertools-tracing
75 |
76 |
77 | software.amazon.lambda
78 | powertools-logging
79 |
80 |
81 | software.amazon.lambda
82 | powertools-metrics
83 |
84 |
85 |
86 |
87 |
88 |
89 | compile
90 |
91 |
92 |
93 |
94 |
95 | org.apache.maven.plugins
96 | maven-shade-plugin
97 | 3.4.1
98 |
99 |
100 | package
101 |
102 | shade
103 |
104 |
105 |
106 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 | com.github.edwgiz
116 | maven-shade-plugin.log4j2-cachefile-transformer
117 | 2.15
118 |
119 |
120 |
121 |
122 |
123 | org.apache.maven.plugins
124 | maven-surefire-plugin
125 |
126 |
127 | handler
128 |
129 |
130 |
131 |
132 |
133 |
134 |
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | helloworld
5 | HelloWorld
6 | 1.0
7 | jar
8 | A sample Hello World created for SAM CLI.
9 |
10 | 1.8
11 | 1.8
12 | 2.17.2
13 | UTF-8
14 |
15 |
16 |
17 |
18 | software.amazon.lambda
19 | powertools-tracing
20 | 1.13.0
21 |
22 |
23 | software.amazon.lambda
24 | powertools-logging
25 | 1.13.0
26 |
27 |
28 | software.amazon.lambda
29 | powertools-metrics
30 | 1.10.2
31 |
32 |
33 | com.amazonaws
34 | aws-lambda-java-core
35 | 1.2.1
36 |
37 |
38 | com.amazonaws
39 | aws-lambda-java-events
40 | 3.11.0
41 |
42 |
43 | org.apache.logging.log4j
44 | log4j-core
45 | ${log4j.version}
46 |
47 |
48 | org.apache.logging.log4j
49 | log4j-api
50 | ${log4j.version}
51 |
52 |
53 |
54 | junit
55 | junit
56 | 4.13.2
57 | test
58 |
59 |
60 |
61 |
62 |
63 |
64 | org.codehaus.mojo
65 | aspectj-maven-plugin
66 | 1.14.0
67 |
68 | ${maven.compiler.source}
69 | ${maven.compiler.target}
70 | ${maven.compiler.target}
71 |
72 |
73 | software.amazon.lambda
74 | powertools-tracing
75 |
76 |
77 | software.amazon.lambda
78 | powertools-logging
79 |
80 |
81 | software.amazon.lambda
82 | powertools-metrics
83 |
84 |
85 |
86 |
87 |
88 |
89 | compile
90 |
91 |
92 |
93 |
94 |
95 | org.apache.maven.plugins
96 | maven-shade-plugin
97 | 3.4.1
98 |
99 |
100 | package
101 |
102 | shade
103 |
104 |
105 |
106 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 | com.github.edwgiz
116 | maven-shade-plugin.log4j2-cachefile-transformer
117 | 2.15
118 |
119 |
120 |
121 |
122 |
123 | org.apache.maven.plugins
124 | maven-surefire-plugin
125 |
126 |
127 | handler
128 |
129 |
130 |
131 |
132 |
133 |
134 |
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/HelloWorldFunction/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | helloworld
5 | HelloWorld
6 | 1.0
7 | jar
8 | A sample Hello World created for SAM CLI.
9 |
10 | 1.8
11 | 1.8
12 | 2.17.2
13 | UTF-8
14 |
15 |
16 |
17 |
18 | software.amazon.lambda
19 | powertools-tracing
20 | 1.12.0
21 |
22 |
23 | software.amazon.lambda
24 | powertools-logging
25 | 1.12.0
26 |
27 |
28 | software.amazon.lambda
29 | powertools-metrics
30 | 1.12.0
31 |
32 |
33 | com.amazonaws
34 | aws-lambda-java-core
35 | 1.2.1
36 |
37 |
38 | com.amazonaws
39 | aws-lambda-java-events
40 | 3.11.0
41 |
42 |
43 | org.apache.logging.log4j
44 | log4j-core
45 | ${log4j.version}
46 |
47 |
48 | org.apache.logging.log4j
49 | log4j-api
50 | ${log4j.version}
51 |
52 |
53 |
54 | junit
55 | junit
56 | 4.13.2
57 | test
58 |
59 |
60 |
61 |
62 |
63 |
64 | org.codehaus.mojo
65 | aspectj-maven-plugin
66 | 1.14.0
67 |
68 | ${maven.compiler.source}
69 | ${maven.compiler.target}
70 | ${maven.compiler.target}
71 |
72 |
73 | software.amazon.lambda
74 | powertools-tracing
75 |
76 |
77 | software.amazon.lambda
78 | powertools-logging
79 |
80 |
81 | software.amazon.lambda
82 | powertools-metrics
83 |
84 |
85 |
86 |
87 |
88 |
89 | compile
90 |
91 |
92 |
93 |
94 |
95 | org.apache.maven.plugins
96 | maven-shade-plugin
97 | 3.4.1
98 |
99 |
100 | package
101 |
102 | shade
103 |
104 |
105 |
106 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 | com.github.edwgiz
116 | maven-shade-plugin.log4j2-cachefile-transformer
117 | 2.15
118 |
119 |
120 |
121 |
122 |
123 | org.apache.maven.plugins
124 | maven-surefire-plugin
125 |
126 |
127 | handler
128 |
129 |
130 |
131 |
132 |
133 |
134 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/HelloWorldFunction/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/README.md:
--------------------------------------------------------------------------------
1 | # {{ cookiecutter.project_name }}
2 |
3 | This project contains source code and supporting files for a serverless application that you can deploy with the SAM CLI. It includes [Lambda Powertools for operational best practices](https://github.com/awslabs/aws-lambda-powertools-java), and the following files and folders.
4 |
5 | - HelloWorldFunction/src/main - Code for the application's Lambda function.
6 | - events - Invocation events that you can use to invoke the function.
7 | - HelloWorldFunction/src/test - Unit tests for the application code.
8 | - template.yaml - A template that defines the application's AWS resources.
9 |
10 | The application uses several AWS resources, including Lambda functions and an API Gateway API. These resources are defined in the `template.yaml` file in this project. You can update the template to add AWS resources through the same deployment process that updates your application code.
11 |
12 | If you prefer to use an integrated development environment (IDE) to build and test your application, you can use the AWS Toolkit.
13 | The AWS Toolkit is an open source plug-in for popular IDEs that uses the SAM CLI to build and deploy serverless applications on AWS. The AWS Toolkit also adds a simplified step-through debugging experience for Lambda function code. See the following links to get started.
14 |
15 | * [PyCharm](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html)
16 | * [IntelliJ](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html)
17 | * [VS Code](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/welcome.html)
18 | * [Visual Studio](https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/welcome.html)
19 |
20 | ## Deploy the sample application
21 |
22 | The Serverless Application Model Command Line Interface (SAM CLI) is an extension of the AWS CLI that adds functionality for building and testing Lambda applications. It uses Docker to run your functions in an Amazon Linux environment that matches Lambda. It can also emulate your application's build environment and API.
23 |
24 | To use the SAM CLI, you need the following tools.
25 |
26 | * SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
27 | * Java11 - [Install the Java 11](https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html)
28 | * Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community)
29 |
30 | To build and deploy your application for the first time, run the following in your shell:
31 |
32 | ```bash
33 | {{ cookiecutter.project_slug }}$ sam build
34 | {{ cookiecutter.project_slug }}$ sam deploy --guided
35 | ```
36 |
37 | The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts:
38 |
39 | * **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name.
40 | * **AWS Region**: The AWS region you want to deploy your app to.
41 | * **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes.
42 | * **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command.
43 | * **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application.
44 |
45 | You can find your API Gateway Endpoint URL in the output values displayed after deployment.
46 |
47 | ## Use the SAM CLI to build and test locally
48 |
49 | Build your application with the `sam build` command.
50 |
51 | ```bash
52 | {{ cookiecutter.project_slug }}$ sam build
53 | ```
54 |
55 | The SAM CLI installs dependencies defined in `HelloWorldFunction/pom.xml`, creates a deployment package, and saves it in the `.aws-sam/build` folder.
56 |
57 | Test a single function by invoking it directly with a test event. An event is a JSON document that represents the input that the function receives from the event source. Test events are included in the `events` folder in this project.
58 |
59 | Run functions locally and invoke them with the `sam local invoke` command.
60 |
61 | ```bash
62 | {{ cookiecutter.project_slug }}$ sam local invoke HelloWorldFunction --event events/event.json
63 | ```
64 |
65 | The SAM CLI can also emulate your application's API. Use the `sam local start-api` to run the API locally on port 3000.
66 |
67 | ```bash
68 | {{ cookiecutter.project_slug }}$ sam local start-api
69 | {{ cookiecutter.project_slug }}$ curl http://localhost:3000/
70 | ```
71 |
72 | The SAM CLI reads the application template to determine the API's routes and the functions that they invoke. The `Events` property on each function's definition includes the route and method for each path.
73 |
74 | ```yaml
75 | Events:
76 | HelloWorld:
77 | Type: Api
78 | Properties:
79 | Path: /hello
80 | Method: get
81 | ```
82 |
83 | ## Add a resource to your application
84 | The application template uses AWS Serverless Application Model (AWS SAM) to define application resources. AWS SAM is an extension of AWS CloudFormation with a simpler syntax for configuring common serverless application resources such as functions, triggers, and APIs. For resources not included in [the SAM specification](https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md), you can use standard [AWS CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) resource types.
85 |
86 | ## Fetch, tail, and filter Lambda function logs
87 |
88 | To simplify troubleshooting, SAM CLI has a command called `sam logs`. `sam logs` lets you fetch logs generated by your deployed Lambda function from the command line. In addition to printing the logs on the terminal, this command has several nifty features to help you quickly find the bug.
89 |
90 | `NOTE`: This command works for all AWS Lambda functions; not just the ones you deploy using SAM.
91 |
92 | ```bash
93 | {{ cookiecutter.project_slug }}$ sam logs -n HelloWorldFunction --stack-name --tail
94 | ```
95 |
96 | You can find more information and examples about filtering Lambda function logs in the [SAM CLI Documentation](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-logging.html).
97 |
98 | ## Unit tests
99 |
100 | Tests are defined in the `HelloWorldFunction/src/test` folder in this project.
101 |
102 | ```bash
103 | {{ cookiecutter.project_slug }}$ cd HelloWorldFunction
104 | HelloWorldFunction$ mvn test
105 | ```
106 |
107 | ## Cleanup
108 |
109 | To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following:
110 |
111 | ```bash
112 | aws cloudformation delete-stack --stack-name
113 | ```
114 |
115 | # Appendix
116 |
117 | ## Powertools
118 |
119 | **Tracing**
120 |
121 | [Tracing utility](https://awslabs.github.io/aws-lambda-powertools-java/core/tracing/) provides functionality to reduce the overhead of performing common tracing tasks. It traces the execution of this sample code including the response and exceptions as tracing metadata - You can visualize them in AWS X-Ray.
122 |
123 | **Logger**
124 |
125 | [Logging utility](https://awslabs.github.io/aws-lambda-powertools-java/core/logging/) creates an opinionated application Logger with structured logging as the output, dynamically samples a percentage (samplingRate) of your logs in DEBUG mode for concurrent invocations, log incoming events as your function is invoked, and injects key information from Lambda context object into your Logger - You can visualize them in Amazon CloudWatch Logs.
126 |
127 | **Metrics**
128 |
129 | [Metrics utility](https://awslabs.github.io/aws-lambda-powertools-java/core/metrics/) captures cold start metric of your Lambda invocation, and could add additional metrics to help you understand your application KPIs - You can visualize them in Amazon CloudWatch.
130 |
131 | ## Resources
132 |
133 | See the [AWS SAM developer guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) for an introduction to SAM specification, the SAM CLI, and serverless application concepts.
134 |
135 | Check the [AWS Lambda Powertools Java](https://awslabs.github.io/aws-lambda-powertools-java/) for more information on how to use and configure such tools
136 |
137 | Next, you can use AWS Serverless Application Repository to deploy ready to use Apps that go beyond hello world samples and learn how authors developed their applications: [AWS Serverless Application Repository main page](https://aws.amazon.com/serverless/serverlessrepo/)
138 |
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/README.md:
--------------------------------------------------------------------------------
1 | # {{ cookiecutter.project_name }}
2 |
3 | This project contains source code and supporting files for a serverless application that you can deploy with the SAM CLI. It includes [Lambda Powertools for operational best practices](https://github.com/awslabs/aws-lambda-powertools-java), and the following files and folders.
4 |
5 | - HelloWorldFunction/src/main - Code for the application's Lambda function.
6 | - events - Invocation events that you can use to invoke the function.
7 | - HelloWorldFunction/src/test - Unit tests for the application code.
8 | - template.yaml - A template that defines the application's AWS resources.
9 |
10 | The application uses several AWS resources, including Lambda functions and an API Gateway API. These resources are defined in the `template.yaml` file in this project. You can update the template to add AWS resources through the same deployment process that updates your application code.
11 |
12 | If you prefer to use an integrated development environment (IDE) to build and test your application, you can use the AWS Toolkit.
13 | The AWS Toolkit is an open source plug-in for popular IDEs that uses the SAM CLI to build and deploy serverless applications on AWS. The AWS Toolkit also adds a simplified step-through debugging experience for Lambda function code. See the following links to get started.
14 |
15 | * [PyCharm](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html)
16 | * [IntelliJ](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html)
17 | * [VS Code](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/welcome.html)
18 | * [Visual Studio](https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/welcome.html)
19 |
20 | ## Deploy the sample application
21 |
22 | The Serverless Application Model Command Line Interface (SAM CLI) is an extension of the AWS CLI that adds functionality for building and testing Lambda applications. It uses Docker to run your functions in an Amazon Linux environment that matches Lambda. It can also emulate your application's build environment and API.
23 |
24 | To use the SAM CLI, you need the following tools.
25 |
26 | * SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
27 | * Java8 - [Install the Java SE Development Kit 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
28 | * Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community)
29 |
30 | To build and deploy your application for the first time, run the following in your shell:
31 |
32 | ```bash
33 | {{ cookiecutter.project_slug }}$ sam build
34 | {{ cookiecutter.project_slug }}$ sam deploy --guided
35 | ```
36 |
37 | The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts:
38 |
39 | * **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name.
40 | * **AWS Region**: The AWS region you want to deploy your app to.
41 | * **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes.
42 | * **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command.
43 | * **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application.
44 |
45 | You can find your API Gateway Endpoint URL in the output values displayed after deployment.
46 |
47 | ## Use the SAM CLI to build and test locally
48 |
49 | Build your application with the `sam build` command.
50 |
51 | ```bash
52 | {{ cookiecutter.project_slug }}$ sam build
53 | ```
54 |
55 | The SAM CLI installs dependencies defined in `HelloWorldFunction/pom.xml`, creates a deployment package, and saves it in the `.aws-sam/build` folder.
56 |
57 | Test a single function by invoking it directly with a test event. An event is a JSON document that represents the input that the function receives from the event source. Test events are included in the `events` folder in this project.
58 |
59 | Run functions locally and invoke them with the `sam local invoke` command.
60 |
61 | ```bash
62 | {{ cookiecutter.project_slug }}$ sam local invoke HelloWorldFunction --event events/event.json
63 | ```
64 |
65 | The SAM CLI can also emulate your application's API. Use the `sam local start-api` to run the API locally on port 3000.
66 |
67 | ```bash
68 | {{ cookiecutter.project_slug }}$ sam local start-api
69 | {{ cookiecutter.project_slug }}$ curl http://localhost:3000/
70 | ```
71 |
72 | The SAM CLI reads the application template to determine the API's routes and the functions that they invoke. The `Events` property on each function's definition includes the route and method for each path.
73 |
74 | ```yaml
75 | Events:
76 | HelloWorld:
77 | Type: Api
78 | Properties:
79 | Path: /hello
80 | Method: get
81 | ```
82 |
83 | ## Add a resource to your application
84 | The application template uses AWS Serverless Application Model (AWS SAM) to define application resources. AWS SAM is an extension of AWS CloudFormation with a simpler syntax for configuring common serverless application resources such as functions, triggers, and APIs. For resources not included in [the SAM specification](https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md), you can use standard [AWS CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) resource types.
85 |
86 | ## Fetch, tail, and filter Lambda function logs
87 |
88 | To simplify troubleshooting, SAM CLI has a command called `sam logs`. `sam logs` lets you fetch logs generated by your deployed Lambda function from the command line. In addition to printing the logs on the terminal, this command has several nifty features to help you quickly find the bug.
89 |
90 | `NOTE`: This command works for all AWS Lambda functions; not just the ones you deploy using SAM.
91 |
92 | ```bash
93 | {{ cookiecutter.project_slug }}$ sam logs -n HelloWorldFunction --stack-name --tail
94 | ```
95 |
96 | You can find more information and examples about filtering Lambda function logs in the [SAM CLI Documentation](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-logging.html).
97 |
98 | ## Unit tests
99 |
100 | Tests are defined in the `HelloWorldFunction/src/test` folder in this project.
101 |
102 | ```bash
103 | {{ cookiecutter.project_slug }}$ cd HelloWorldFunction
104 | HelloWorldFunction$ mvn test
105 | ```
106 |
107 | ## Cleanup
108 |
109 | To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following:
110 |
111 | ```bash
112 | aws cloudformation delete-stack --stack-name
113 | ```
114 |
115 | # Appendix
116 |
117 | ## Powertools
118 |
119 | **Tracing**
120 |
121 | [Tracing utility](https://awslabs.github.io/aws-lambda-powertools-java/core/tracing/) provides functionality to reduce the overhead of performing common tracing tasks. It traces the execution of this sample code including the response and exceptions as tracing metadata - You can visualize them in AWS X-Ray.
122 |
123 | **Logger**
124 |
125 | [Logging utility](https://awslabs.github.io/aws-lambda-powertools-java/core/logging/) creates an opinionated application Logger with structured logging as the output, dynamically samples a percentage (samplingRate) of your logs in DEBUG mode for concurrent invocations, log incoming events as your function is invoked, and injects key information from Lambda context object into your Logger - You can visualize them in Amazon CloudWatch Logs.
126 |
127 | **Metrics**
128 |
129 | [Metrics utility](https://awslabs.github.io/aws-lambda-powertools-java/core/metrics/) captures cold start metric of your Lambda invocation, and could add additional metrics to help you understand your application KPIs - You can visualize them in Amazon CloudWatch.
130 |
131 | ## Resources
132 |
133 | See the [AWS SAM developer guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) for an introduction to SAM specification, the SAM CLI, and serverless application concepts.
134 |
135 | Check the [AWS Lambda Powertools Java](https://awslabs.github.io/aws-lambda-powertools-java/) for more information on how to use and configure such tools
136 |
137 | Next, you can use AWS Serverless Application Repository to deploy ready to use Apps that go beyond hello world samples and learn how authors developed their applications: [AWS Serverless Application Repository main page](https://aws.amazon.com/serverless/serverlessrepo/)
138 |
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-gradle/{{ cookiecutter.project_slug }}/README.md:
--------------------------------------------------------------------------------
1 | # {{ cookiecutter.project_name }}
2 |
3 | This project contains source code and supporting files for a serverless application that you can deploy with the SAM CLI. It includes [Lambda Powertools for operational best practices](https://github.com/awslabs/aws-lambda-powertools-java), and the following files and folders.
4 |
5 | - HelloWorldFunction/src/main - Code for the application's Lambda function.
6 | - events - Invocation events that you can use to invoke the function.
7 | - HelloWorldFunction/src/test - Unit tests for the application code.
8 | - template.yaml - A template that defines the application's AWS resources.
9 |
10 | The application uses several AWS resources, including Lambda functions and an API Gateway API. These resources are defined in the `template.yaml` file in this project. You can update the template to add AWS resources through the same deployment process that updates your application code.
11 |
12 | If you prefer to use an integrated development environment (IDE) to build and test your application, you can use the AWS Toolkit.
13 | The AWS Toolkit is an open source plug-in for popular IDEs that uses the SAM CLI to build and deploy serverless applications on AWS. The AWS Toolkit also adds a simplified step-through debugging experience for Lambda function code. See the following links to get started.
14 |
15 | * [PyCharm](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html)
16 | * [IntelliJ](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html)
17 | * [VS Code](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/welcome.html)
18 | * [Visual Studio](https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/welcome.html)
19 |
20 | ## Deploy the sample application
21 |
22 | The Serverless Application Model Command Line Interface (SAM CLI) is an extension of the AWS CLI that adds functionality for building and testing Lambda applications. It uses Docker to run your functions in an Amazon Linux environment that matches Lambda. It can also emulate your application's build environment and API.
23 |
24 | To use the SAM CLI, you need the following tools.
25 |
26 | * SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
27 | * Java8 - [Install the Java SE Development Kit 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
28 | * Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community)
29 |
30 | To build and deploy your application for the first time, run the following in your shell:
31 |
32 | ```bash
33 | {{ cookiecutter.project_slug }}$ sam build
34 | {{ cookiecutter.project_slug }}$ sam deploy --guided
35 | ```
36 |
37 | The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts:
38 |
39 | * **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name.
40 | * **AWS Region**: The AWS region you want to deploy your app to.
41 | * **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes.
42 | * **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command.
43 | * **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application.
44 |
45 | You can find your API Gateway Endpoint URL in the output values displayed after deployment.
46 |
47 | ## Use the SAM CLI to build and test locally
48 |
49 | Build your application with the `sam build` command.
50 |
51 | ```bash
52 | {{ cookiecutter.project_slug }}$ sam build
53 | ```
54 |
55 | The SAM CLI installs dependencies defined in `HelloWorldFunction/pom.xml`, creates a deployment package, and saves it in the `.aws-sam/build` folder.
56 |
57 | Test a single function by invoking it directly with a test event. An event is a JSON document that represents the input that the function receives from the event source. Test events are included in the `events` folder in this project.
58 |
59 | Run functions locally and invoke them with the `sam local invoke` command.
60 |
61 | ```bash
62 | {{ cookiecutter.project_slug }}$ sam local invoke HelloWorldFunction --event events/event.json
63 | ```
64 |
65 | The SAM CLI can also emulate your application's API. Use the `sam local start-api` to run the API locally on port 3000.
66 |
67 | ```bash
68 | {{ cookiecutter.project_slug }}$ sam local start-api
69 | {{ cookiecutter.project_slug }}$ curl http://localhost:3000/
70 | ```
71 |
72 | The SAM CLI reads the application template to determine the API's routes and the functions that they invoke. The `Events` property on each function's definition includes the route and method for each path.
73 |
74 | ```yaml
75 | Events:
76 | HelloWorld:
77 | Type: Api
78 | Properties:
79 | Path: /hello
80 | Method: get
81 | ```
82 |
83 | ## Add a resource to your application
84 | The application template uses AWS Serverless Application Model (AWS SAM) to define application resources. AWS SAM is an extension of AWS CloudFormation with a simpler syntax for configuring common serverless application resources such as functions, triggers, and APIs. For resources not included in [the SAM specification](https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md), you can use standard [AWS CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) resource types.
85 |
86 | ## Fetch, tail, and filter Lambda function logs
87 |
88 | To simplify troubleshooting, SAM CLI has a command called `sam logs`. `sam logs` lets you fetch logs generated by your deployed Lambda function from the command line. In addition to printing the logs on the terminal, this command has several nifty features to help you quickly find the bug.
89 |
90 | `NOTE`: This command works for all AWS Lambda functions; not just the ones you deploy using SAM.
91 |
92 | ```bash
93 | {{ cookiecutter.project_slug }}$ sam logs -n HelloWorldFunction --stack-name --tail
94 | ```
95 |
96 | You can find more information and examples about filtering Lambda function logs in the [SAM CLI Documentation](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-logging.html).
97 |
98 | ## Unit tests
99 |
100 | Tests are defined in the `HelloWorldFunction/src/test` folder in this project.
101 |
102 | ```bash
103 | {{ cookiecutter.project_slug }}$ cd HelloWorldFunction
104 | HelloWorldFunction$ mvn test
105 | ```
106 |
107 | ## Cleanup
108 |
109 | To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following:
110 |
111 | ```bash
112 | aws cloudformation delete-stack --stack-name
113 | ```
114 |
115 | # Appendix
116 |
117 | ## Powertools
118 |
119 | **Tracing**
120 |
121 | [Tracing utility](https://awslabs.github.io/aws-lambda-powertools-java/core/tracing/) provides functionality to reduce the overhead of performing common tracing tasks. It traces the execution of this sample code including the response and exceptions as tracing metadata - You can visualize them in AWS X-Ray.
122 |
123 | **Logger**
124 |
125 | [Logging utility](https://awslabs.github.io/aws-lambda-powertools-java/core/logging/) creates an opinionated application Logger with structured logging as the output, dynamically samples a percentage (samplingRate) of your logs in DEBUG mode for concurrent invocations, log incoming events as your function is invoked, and injects key information from Lambda context object into your Logger - You can visualize them in Amazon CloudWatch Logs.
126 |
127 | **Metrics**
128 |
129 | [Metrics utility](https://awslabs.github.io/aws-lambda-powertools-java/core/metrics/) captures cold start metric of your Lambda invocation, and could add additional metrics to help you understand your application KPIs - You can visualize them in Amazon CloudWatch.
130 |
131 | ## Resources
132 |
133 | See the [AWS SAM developer guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) for an introduction to SAM specification, the SAM CLI, and serverless application concepts.
134 |
135 | Check the [AWS Lambda Powertools Java](https://awslabs.github.io/aws-lambda-powertools-java/) for more information on how to use and configure such tools
136 |
137 | Next, you can use AWS Serverless Application Repository to deploy ready to use Apps that go beyond hello world samples and learn how authors developed their applications: [AWS Serverless Application Repository main page](https://aws.amazon.com/serverless/serverlessrepo/)
138 |
--------------------------------------------------------------------------------
/templates/java11/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/README.md:
--------------------------------------------------------------------------------
1 | # {{ cookiecutter.project_name }}
2 |
3 | This project contains source code and supporting files for a serverless application that you can deploy with the SAM CLI. It includes [Lambda Powertools for operational best practices](https://github.com/awslabs/aws-lambda-powertools-java), and the following files and folders.
4 |
5 | - HelloWorldFunction/src/main - Code for the application's Lambda function.
6 | - events - Invocation events that you can use to invoke the function.
7 | - HelloWorldFunction/src/test - Unit tests for the application code.
8 | - template.yaml - A template that defines the application's AWS resources.
9 |
10 | The application uses several AWS resources, including Lambda functions and an API Gateway API. These resources are defined in the `template.yaml` file in this project. You can update the template to add AWS resources through the same deployment process that updates your application code.
11 |
12 | If you prefer to use an integrated development environment (IDE) to build and test your application, you can use the AWS Toolkit.
13 | The AWS Toolkit is an open source plug-in for popular IDEs that uses the SAM CLI to build and deploy serverless applications on AWS. The AWS Toolkit also adds a simplified step-through debugging experience for Lambda function code. See the following links to get started.
14 |
15 | * [PyCharm](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html)
16 | * [IntelliJ](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html)
17 | * [VS Code](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/welcome.html)
18 | * [Visual Studio](https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/welcome.html)
19 |
20 | ## Deploy the sample application
21 |
22 | The Serverless Application Model Command Line Interface (SAM CLI) is an extension of the AWS CLI that adds functionality for building and testing Lambda applications. It uses Docker to run your functions in an Amazon Linux environment that matches Lambda. It can also emulate your application's build environment and API.
23 |
24 | To use the SAM CLI, you need the following tools.
25 |
26 | * SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
27 | * Java11 - [Install the Java 11](https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html)
28 | * Maven - [Install Maven](https://maven.apache.org/install.html)
29 | * Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community)
30 |
31 | To build and deploy your application for the first time, run the following in your shell:
32 |
33 | ```bash
34 | {{ cookiecutter.project_slug }}$ sam build
35 | {{ cookiecutter.project_slug }}$ sam deploy --guided
36 | ```
37 |
38 | The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts:
39 |
40 | * **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name.
41 | * **AWS Region**: The AWS region you want to deploy your app to.
42 | * **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes.
43 | * **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command.
44 | * **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application.
45 |
46 | You can find your API Gateway Endpoint URL in the output values displayed after deployment.
47 |
48 | ## Use the SAM CLI to build and test locally
49 |
50 | Build your application with the `sam build` command.
51 |
52 | ```bash
53 | {{ cookiecutter.project_slug }}$ sam build
54 | ```
55 |
56 | The SAM CLI installs dependencies defined in `HelloWorldFunction/pom.xml`, creates a deployment package, and saves it in the `.aws-sam/build` folder.
57 |
58 | Test a single function by invoking it directly with a test event. An event is a JSON document that represents the input that the function receives from the event source. Test events are included in the `events` folder in this project.
59 |
60 | Run functions locally and invoke them with the `sam local invoke` command.
61 |
62 | ```bash
63 | {{ cookiecutter.project_slug }}$ sam local invoke HelloWorldFunction --event events/event.json
64 | ```
65 |
66 | The SAM CLI can also emulate your application's API. Use the `sam local start-api` to run the API locally on port 3000.
67 |
68 | ```bash
69 | {{ cookiecutter.project_slug }}$ sam local start-api
70 | {{ cookiecutter.project_slug }}$ curl http://localhost:3000/
71 | ```
72 |
73 | The SAM CLI reads the application template to determine the API's routes and the functions that they invoke. The `Events` property on each function's definition includes the route and method for each path.
74 |
75 | ```yaml
76 | Events:
77 | HelloWorld:
78 | Type: Api
79 | Properties:
80 | Path: /hello
81 | Method: get
82 | ```
83 |
84 | ## Add a resource to your application
85 | The application template uses AWS Serverless Application Model (AWS SAM) to define application resources. AWS SAM is an extension of AWS CloudFormation with a simpler syntax for configuring common serverless application resources such as functions, triggers, and APIs. For resources not included in [the SAM specification](https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md), you can use standard [AWS CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) resource types.
86 |
87 | ## Fetch, tail, and filter Lambda function logs
88 |
89 | To simplify troubleshooting, SAM CLI has a command called `sam logs`. `sam logs` lets you fetch logs generated by your deployed Lambda function from the command line. In addition to printing the logs on the terminal, this command has several nifty features to help you quickly find the bug.
90 |
91 | `NOTE`: This command works for all AWS Lambda functions; not just the ones you deploy using SAM.
92 |
93 | ```bash
94 | {{ cookiecutter.project_slug }}$ sam logs -n HelloWorldFunction --stack-name --tail
95 | ```
96 |
97 | You can find more information and examples about filtering Lambda function logs in the [SAM CLI Documentation](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-logging.html).
98 |
99 | ## Unit tests
100 |
101 | Tests are defined in the `HelloWorldFunction/src/test` folder in this project.
102 |
103 | ```bash
104 | {{ cookiecutter.project_slug }}$ cd HelloWorldFunction
105 | HelloWorldFunction$ mvn test
106 | ```
107 |
108 | ## Cleanup
109 |
110 | To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following:
111 |
112 | ```bash
113 | aws cloudformation delete-stack --stack-name
114 | ```
115 |
116 | # Appendix
117 |
118 | ## Powertools
119 |
120 | **Tracing**
121 |
122 | [Tracing utility](https://awslabs.github.io/aws-lambda-powertools-java/core/tracing/) provides functionality to reduce the overhead of performing common tracing tasks. It traces the execution of this sample code including the response and exceptions as tracing metadata - You can visualize them in AWS X-Ray.
123 |
124 | **Logger**
125 |
126 | [Logging utility](https://awslabs.github.io/aws-lambda-powertools-java/core/logging/) creates an opinionated application Logger with structured logging as the output, dynamically samples a percentage (samplingRate) of your logs in DEBUG mode for concurrent invocations, log incoming events as your function is invoked, and injects key information from Lambda context object into your Logger - You can visualize them in Amazon CloudWatch Logs.
127 |
128 | **Metrics**
129 |
130 | [Metrics utility](https://awslabs.github.io/aws-lambda-powertools-java/core/metrics/) captures cold start metric of your Lambda invocation, and could add additional metrics to help you understand your application KPIs - You can visualize them in Amazon CloudWatch.
131 |
132 | ## Resources
133 |
134 | See the [AWS SAM developer guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) for an introduction to SAM specification, the SAM CLI, and serverless application concepts.
135 |
136 | Check the [AWS Lambda Powertools Java](https://awslabs.github.io/aws-lambda-powertools-java/) for more information on how to use and configure such tools
137 |
138 | Next, you can use AWS Serverless Application Repository to deploy ready to use Apps that go beyond hello world samples and learn how authors developed their applications: [AWS Serverless Application Repository main page](https://aws.amazon.com/serverless/serverlessrepo/)
139 |
--------------------------------------------------------------------------------
/templates/java8/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/README.md:
--------------------------------------------------------------------------------
1 | # {{ cookiecutter.project_name }}
2 |
3 | This project contains source code and supporting files for a serverless application that you can deploy with the SAM CLI. It includes [Lambda Powertools for operational best practices](https://github.com/awslabs/aws-lambda-powertools-java), and the following files and folders.
4 |
5 | - HelloWorldFunction/src/main - Code for the application's Lambda function.
6 | - events - Invocation events that you can use to invoke the function.
7 | - HelloWorldFunction/src/test - Unit tests for the application code.
8 | - template.yaml - A template that defines the application's AWS resources.
9 |
10 | The application uses several AWS resources, including Lambda functions and an API Gateway API. These resources are defined in the `template.yaml` file in this project. You can update the template to add AWS resources through the same deployment process that updates your application code.
11 |
12 | If you prefer to use an integrated development environment (IDE) to build and test your application, you can use the AWS Toolkit.
13 | The AWS Toolkit is an open source plug-in for popular IDEs that uses the SAM CLI to build and deploy serverless applications on AWS. The AWS Toolkit also adds a simplified step-through debugging experience for Lambda function code. See the following links to get started.
14 |
15 | * [PyCharm](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html)
16 | * [IntelliJ](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html)
17 | * [VS Code](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/welcome.html)
18 | * [Visual Studio](https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/welcome.html)
19 |
20 | ## Deploy the sample application
21 |
22 | The Serverless Application Model Command Line Interface (SAM CLI) is an extension of the AWS CLI that adds functionality for building and testing Lambda applications. It uses Docker to run your functions in an Amazon Linux environment that matches Lambda. It can also emulate your application's build environment and API.
23 |
24 | To use the SAM CLI, you need the following tools.
25 |
26 | * SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
27 | * Java8 - [Install the Java SE Development Kit 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
28 | * Maven - [Install Maven](https://maven.apache.org/install.html)
29 | * Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community)
30 |
31 | To build and deploy your application for the first time, run the following in your shell:
32 |
33 | ```bash
34 | {{ cookiecutter.project_slug }}$ sam build
35 | {{ cookiecutter.project_slug }}$ sam deploy --guided
36 | ```
37 |
38 | The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts:
39 |
40 | * **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name.
41 | * **AWS Region**: The AWS region you want to deploy your app to.
42 | * **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes.
43 | * **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command.
44 | * **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application.
45 |
46 | You can find your API Gateway Endpoint URL in the output values displayed after deployment.
47 |
48 | ## Use the SAM CLI to build and test locally
49 |
50 | Build your application with the `sam build` command.
51 |
52 | ```bash
53 | {{ cookiecutter.project_slug }}$ sam build
54 | ```
55 |
56 | The SAM CLI installs dependencies defined in `HelloWorldFunction/pom.xml`, creates a deployment package, and saves it in the `.aws-sam/build` folder.
57 |
58 | Test a single function by invoking it directly with a test event. An event is a JSON document that represents the input that the function receives from the event source. Test events are included in the `events` folder in this project.
59 |
60 | Run functions locally and invoke them with the `sam local invoke` command.
61 |
62 | ```bash
63 | {{ cookiecutter.project_slug }}$ sam local invoke HelloWorldFunction --event events/event.json
64 | ```
65 |
66 | The SAM CLI can also emulate your application's API. Use the `sam local start-api` to run the API locally on port 3000.
67 |
68 | ```bash
69 | {{ cookiecutter.project_slug }}$ sam local start-api
70 | {{ cookiecutter.project_slug }}$ curl http://localhost:3000/
71 | ```
72 |
73 | The SAM CLI reads the application template to determine the API's routes and the functions that they invoke. The `Events` property on each function's definition includes the route and method for each path.
74 |
75 | ```yaml
76 | Events:
77 | HelloWorld:
78 | Type: Api
79 | Properties:
80 | Path: /hello
81 | Method: get
82 | ```
83 |
84 | ## Add a resource to your application
85 | The application template uses AWS Serverless Application Model (AWS SAM) to define application resources. AWS SAM is an extension of AWS CloudFormation with a simpler syntax for configuring common serverless application resources such as functions, triggers, and APIs. For resources not included in [the SAM specification](https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md), you can use standard [AWS CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) resource types.
86 |
87 | ## Fetch, tail, and filter Lambda function logs
88 |
89 | To simplify troubleshooting, SAM CLI has a command called `sam logs`. `sam logs` lets you fetch logs generated by your deployed Lambda function from the command line. In addition to printing the logs on the terminal, this command has several nifty features to help you quickly find the bug.
90 |
91 | `NOTE`: This command works for all AWS Lambda functions; not just the ones you deploy using SAM.
92 |
93 | ```bash
94 | {{ cookiecutter.project_slug }}$ sam logs -n HelloWorldFunction --stack-name --tail
95 | ```
96 |
97 | You can find more information and examples about filtering Lambda function logs in the [SAM CLI Documentation](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-logging.html).
98 |
99 | ## Unit tests
100 |
101 | Tests are defined in the `HelloWorldFunction/src/test` folder in this project.
102 |
103 | ```bash
104 | {{ cookiecutter.project_slug }}$ cd HelloWorldFunction
105 | HelloWorldFunction$ mvn test
106 | ```
107 |
108 | ## Cleanup
109 |
110 | To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following:
111 |
112 | ```bash
113 | aws cloudformation delete-stack --stack-name
114 | ```
115 |
116 | # Appendix
117 |
118 | ## Powertools
119 |
120 | **Tracing**
121 |
122 | [Tracing utility](https://awslabs.github.io/aws-lambda-powertools-java/core/tracing/) provides functionality to reduce the overhead of performing common tracing tasks. It traces the execution of this sample code including the response and exceptions as tracing metadata - You can visualize them in AWS X-Ray.
123 |
124 | **Logger**
125 |
126 | [Logging utility](https://awslabs.github.io/aws-lambda-powertools-java/core/logging/) creates an opinionated application Logger with structured logging as the output, dynamically samples a percentage (samplingRate) of your logs in DEBUG mode for concurrent invocations, log incoming events as your function is invoked, and injects key information from Lambda context object into your Logger - You can visualize them in Amazon CloudWatch Logs.
127 |
128 | **Metrics**
129 |
130 | [Metrics utility](https://awslabs.github.io/aws-lambda-powertools-java/core/metrics/) captures cold start metric of your Lambda invocation, and could add additional metrics to help you understand your application KPIs - You can visualize them in Amazon CloudWatch.
131 |
132 | ## Resources
133 |
134 | See the [AWS SAM developer guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) for an introduction to SAM specification, the SAM CLI, and serverless application concepts.
135 |
136 | Check the [AWS Lambda Powertools Java](https://awslabs.github.io/aws-lambda-powertools-java/) for more information on how to use and configure such tools
137 |
138 | Next, you can use AWS Serverless Application Repository to deploy ready to use Apps that go beyond hello world samples and learn how authors developed their applications: [AWS Serverless Application Repository main page](https://aws.amazon.com/serverless/serverlessrepo/)
139 |
--------------------------------------------------------------------------------
/templates/java8.al2/cookiecutter-aws-sam-hello-powertools-java-maven/{{ cookiecutter.project_slug }}/README.md:
--------------------------------------------------------------------------------
1 | # {{ cookiecutter.project_name }}
2 |
3 | This project contains source code and supporting files for a serverless application that you can deploy with the SAM CLI. It includes [Lambda Powertools for operational best practices](https://github.com/awslabs/aws-lambda-powertools-java), and the following files and folders.
4 |
5 | - HelloWorldFunction/src/main - Code for the application's Lambda function.
6 | - events - Invocation events that you can use to invoke the function.
7 | - HelloWorldFunction/src/test - Unit tests for the application code.
8 | - template.yaml - A template that defines the application's AWS resources.
9 |
10 | The application uses several AWS resources, including Lambda functions and an API Gateway API. These resources are defined in the `template.yaml` file in this project. You can update the template to add AWS resources through the same deployment process that updates your application code.
11 |
12 | If you prefer to use an integrated development environment (IDE) to build and test your application, you can use the AWS Toolkit.
13 | The AWS Toolkit is an open source plug-in for popular IDEs that uses the SAM CLI to build and deploy serverless applications on AWS. The AWS Toolkit also adds a simplified step-through debugging experience for Lambda function code. See the following links to get started.
14 |
15 | * [PyCharm](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html)
16 | * [IntelliJ](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html)
17 | * [VS Code](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/welcome.html)
18 | * [Visual Studio](https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/welcome.html)
19 |
20 | ## Deploy the sample application
21 |
22 | The Serverless Application Model Command Line Interface (SAM CLI) is an extension of the AWS CLI that adds functionality for building and testing Lambda applications. It uses Docker to run your functions in an Amazon Linux environment that matches Lambda. It can also emulate your application's build environment and API.
23 |
24 | To use the SAM CLI, you need the following tools.
25 |
26 | * SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
27 | * Java8 - [Install the Java SE Development Kit 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
28 | * Maven - [Install Maven](https://maven.apache.org/install.html)
29 | * Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community)
30 |
31 | To build and deploy your application for the first time, run the following in your shell:
32 |
33 | ```bash
34 | {{ cookiecutter.project_slug }}$ sam build
35 | {{ cookiecutter.project_slug }}$ sam deploy --guided
36 | ```
37 |
38 | The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts:
39 |
40 | * **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name.
41 | * **AWS Region**: The AWS region you want to deploy your app to.
42 | * **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes.
43 | * **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command.
44 | * **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application.
45 |
46 | You can find your API Gateway Endpoint URL in the output values displayed after deployment.
47 |
48 | ## Use the SAM CLI to build and test locally
49 |
50 | Build your application with the `sam build` command.
51 |
52 | ```bash
53 | {{ cookiecutter.project_slug }}$ sam build
54 | ```
55 |
56 | The SAM CLI installs dependencies defined in `HelloWorldFunction/pom.xml`, creates a deployment package, and saves it in the `.aws-sam/build` folder.
57 |
58 | Test a single function by invoking it directly with a test event. An event is a JSON document that represents the input that the function receives from the event source. Test events are included in the `events` folder in this project.
59 |
60 | Run functions locally and invoke them with the `sam local invoke` command.
61 |
62 | ```bash
63 | {{ cookiecutter.project_slug }}$ sam local invoke HelloWorldFunction --event events/event.json
64 | ```
65 |
66 | The SAM CLI can also emulate your application's API. Use the `sam local start-api` to run the API locally on port 3000.
67 |
68 | ```bash
69 | {{ cookiecutter.project_slug }}$ sam local start-api
70 | {{ cookiecutter.project_slug }}$ curl http://localhost:3000/
71 | ```
72 |
73 | The SAM CLI reads the application template to determine the API's routes and the functions that they invoke. The `Events` property on each function's definition includes the route and method for each path.
74 |
75 | ```yaml
76 | Events:
77 | HelloWorld:
78 | Type: Api
79 | Properties:
80 | Path: /hello
81 | Method: get
82 | ```
83 |
84 | ## Add a resource to your application
85 | The application template uses AWS Serverless Application Model (AWS SAM) to define application resources. AWS SAM is an extension of AWS CloudFormation with a simpler syntax for configuring common serverless application resources such as functions, triggers, and APIs. For resources not included in [the SAM specification](https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md), you can use standard [AWS CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) resource types.
86 |
87 | ## Fetch, tail, and filter Lambda function logs
88 |
89 | To simplify troubleshooting, SAM CLI has a command called `sam logs`. `sam logs` lets you fetch logs generated by your deployed Lambda function from the command line. In addition to printing the logs on the terminal, this command has several nifty features to help you quickly find the bug.
90 |
91 | `NOTE`: This command works for all AWS Lambda functions; not just the ones you deploy using SAM.
92 |
93 | ```bash
94 | {{ cookiecutter.project_slug }}$ sam logs -n HelloWorldFunction --stack-name --tail
95 | ```
96 |
97 | You can find more information and examples about filtering Lambda function logs in the [SAM CLI Documentation](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-logging.html).
98 |
99 | ## Unit tests
100 |
101 | Tests are defined in the `HelloWorldFunction/src/test` folder in this project.
102 |
103 | ```bash
104 | {{ cookiecutter.project_slug }}$ cd HelloWorldFunction
105 | HelloWorldFunction$ mvn test
106 | ```
107 |
108 | ## Cleanup
109 |
110 | To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following:
111 |
112 | ```bash
113 | aws cloudformation delete-stack --stack-name
114 | ```
115 |
116 | # Appendix
117 |
118 | ## Powertools
119 |
120 | **Tracing**
121 |
122 | [Tracing utility](https://awslabs.github.io/aws-lambda-powertools-java/core/tracing/) provides functionality to reduce the overhead of performing common tracing tasks. It traces the execution of this sample code including the response and exceptions as tracing metadata - You can visualize them in AWS X-Ray.
123 |
124 | **Logger**
125 |
126 | [Logging utility](https://awslabs.github.io/aws-lambda-powertools-java/core/logging/) creates an opinionated application Logger with structured logging as the output, dynamically samples a percentage (samplingRate) of your logs in DEBUG mode for concurrent invocations, log incoming events as your function is invoked, and injects key information from Lambda context object into your Logger - You can visualize them in Amazon CloudWatch Logs.
127 |
128 | **Metrics**
129 |
130 | [Metrics utility](https://awslabs.github.io/aws-lambda-powertools-java/core/metrics/) captures cold start metric of your Lambda invocation, and could add additional metrics to help you understand your application KPIs - You can visualize them in Amazon CloudWatch.
131 |
132 | ## Resources
133 |
134 | See the [AWS SAM developer guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) for an introduction to SAM specification, the SAM CLI, and serverless application concepts.
135 |
136 | Check the [AWS Lambda Powertools Java](https://awslabs.github.io/aws-lambda-powertools-java/) for more information on how to use and configure such tools
137 |
138 | Next, you can use AWS Serverless Application Repository to deploy ready to use Apps that go beyond hello world samples and learn how authors developed their applications: [AWS Serverless Application Repository main page](https://aws.amazon.com/serverless/serverlessrepo/)
139 |
--------------------------------------------------------------------------------