AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
restapi-java
SAM Template for rest-api-java
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 20
Tracing: Active
Api:
TracingEnabled: True
Resources:
RESTJavaAPI:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: ./build/libs/restapi-java-all.jar
Handler: com.serverlesscorner.restapi.StreamLambdaHandler
Runtime: java11
Architectures:
- x86_64
Policies: AWSLambdaBasicExecutionRole
Timeout: 60
MemorySize: 512
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
PARAM1: VALUE
JAVA_TOOL_OPTIONS: -XX:+TieredCompilation -XX:TieredStopAtLevel=1 # More info about tiered compilation https://aws.amazon.com/blogs/compute/optimizing-aws-lambda-function-performance-for-java/
Events:
Service:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /{proxy+}
Method: any
ConfigLambdaPermission:
Type: "AWS::Lambda::Permission"
DependsOn:
- RESTJavaAPI
Properties:
Action: lambda:InvokeFunction
FunctionName: !Ref RESTJavaAPI
Principal: apigateway.amazonaws.com