Files
spring-cloud-function/spring-cloud-function-samples/scf-aws-sam/template.yml
2023-10-26 15:48:11 +02:00

41 lines
1.3 KiB
YAML

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Example of deploying Java function as AWS Lambda Function with AWS API Gateway using Spring Cloud Function support.
Globals:
Api:
# API Gateway regional endpoints
EndpointConfiguration: REGIONAL
Resources:
UppercaseFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: uppercase
Handler: org.springframework.cloud.function.adapter.aws.FunctionInvoker::handleRequest
Runtime: java17
SnapStart:
ApplyOn: PublishedVersions
CodeUri: .
MemorySize: 1024
Policies: AWSLambdaBasicExecutionRole
Timeout: 30
Environment:
Variables:
MAIN_CLASS: oz.spring.aws.FunctionAwsApplication
Events:
HttpApiEvent:
Type: HttpApi
Properties:
TimeoutInMillis: 20000
PayloadFormatVersion: '1.0'
Outputs:
SpringUppercaseApi:
Description: URL for application
Value: !Sub 'https://${ServerlessHttpApi}.execute-api.${AWS::Region}.amazonaws.com/uppercase'
Export:
Name: UppercaseFunction
# curl -H "Content-Type: application/json" -X POST -d '"foobar"' https://jvd5wf478j.execute-api.us-east-2.amazonaws.com/uppercase
# you should receive the response "FOOBAR"