AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: > lambda-quarkus-snapstart Sample SAM Template for quarkus with SnapStart Globals: Function: Tracing: Active CodeUri: target/quarkus-lambda-function-1.0.0-SNAPSHOT-aws.jar Handler: io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::handleRequest Runtime: java17 Timeout: 30 MemorySize: 1024 AutoPublishAlias: live SnapStart: ApplyOn: PublishedVersions Environment: Variables: # Include the "-verbose:class" Java tools option to output classes to # preload in CloudWatch Logs, and the classes are written in # resources/META-INF/quarkus-preload-classes.txt PRODUCT_TABLE_NAME: !Ref ProductsTable Resources: MyApi: Type: AWS::Serverless::Api Properties: TracingEnabled: true StageName: prod Name: My Lambda Quarkus SnapStart API GetProductByIdFunction: Type: AWS::Serverless::Function Properties: Environment: Variables: quarkus_lambda_handler: getProductById Policies: - DynamoDBReadPolicy: TableName: !Ref ProductsTable Events: GetRequestById: Type: Api Properties: RestApiId: !Ref MyApi Path: /products/{id} Method: get GetProductByIdFunctionLogGroup: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub "/aws/lambda/${GetProductByIdFunction}" RetentionInDays: 7 GetProductsFunction: Type: AWS::Serverless::Function Properties: Environment: Variables: quarkus_lambda_handler: getAllProducts Policies: - DynamoDBReadPolicy: TableName: !Ref ProductsTable Events: GetRequest: Type: Api Properties: RestApiId: !Ref MyApi Path: /products Method: get GetProductsFunctionLogGroup: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub "/aws/lambda/${GetProductsFunction}" RetentionInDays: 7 PutProductFunction: Type: AWS::Serverless::Function Properties: Environment: Variables: quarkus_lambda_handler: createProduct Policies: - DynamoDBCrudPolicy: TableName: !Ref ProductsTable Events: PutRequest: Type: Api Properties: RestApiId: !Ref MyApi Path: /products/{id} Method: put PutProductFunctionLogGroup: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub "/aws/lambda/${PutProductFunction}" RetentionInDays: 7 DeleteProductFunction: Type: AWS::Serverless::Function Properties: Environment: Variables: quarkus_lambda_handler: deleteProduct Policies: - DynamoDBCrudPolicy: TableName: !Ref ProductsTable Events: PutRequest: Type: Api Properties: RestApiId: !Ref MyApi Path: /products/{id} Method: delete DeleteProductFunctionLogGroup: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub "/aws/lambda/${DeleteProductFunction}" RetentionInDays: 7 ProductsTable: Type: AWS::DynamoDB::Table Properties: AttributeDefinitions: - AttributeName: 'PK' AttributeType: 'S' KeySchema: - AttributeName: 'PK' KeyType: 'HASH' BillingMode: PAY_PER_REQUEST Outputs: ApiEndpoint: Description: "API Gateway endpoint URL for Prod stage for Quarkus sample function" Value: !Sub "https://${MyApi}.execute-api.${AWS::Region}.amazonaws.com/prod/products"