AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 Globals: Function: MemorySize: 1024 Architectures: [!Ref LambdaArchitecture] Runtime: dotnetcore3.1 Timeout: 30 Tracing: Active Environment: Variables: PRODUCT_TABLE_NAME: !Ref Table Parameters: LambdaArchitecture: Type: String AllowedValues: - arm64 - x86_64 Description: Enter arm64 or x86_64 Resources: GetProductsFunction: Type: AWS::Serverless::Function Properties: CodeUri: ./GetProducts/ Handler: GetProducts::GetProducts.Function::FunctionHandler Events: Api: Type: HttpApi Properties: Path: / Method: GET Policies: - Version: "2012-10-17" Statement: - Effect: Allow Action: dynamodb:Scan Resource: !GetAtt Table.Arn GetProductFunction: Type: AWS::Serverless::Function Properties: CodeUri: ./GetProduct/ Handler: GetProduct::GetProduct.Function::FunctionHandler Events: Api: Type: HttpApi Properties: Path: /{id} Method: GET Policies: - Version: "2012-10-17" Statement: - Effect: Allow Action: dynamodb:GetItem Resource: !GetAtt Table.Arn DeleteProductFunction: Type: AWS::Serverless::Function Properties: CodeUri: ./DeleteProduct/ Handler: DeleteProduct::DeleteProduct.Function::FunctionHandler Events: Api: Type: HttpApi Properties: Path: /{id} Method: DELETE Policies: - Version: "2012-10-17" Statement: - Effect: Allow Action: - dynamodb:DeleteItem - dynamodb:GetItem Resource: !GetAtt Table.Arn PutProductFunction: Type: AWS::Serverless::Function Properties: CodeUri: ./PutProduct/ Handler: PutProduct::PutProduct.Function::FunctionHandler Events: Api: Type: HttpApi Properties: Path: /{id} Method: PUT Policies: - Version: "2012-10-17" Statement: - Effect: Allow Action: dynamodb:PutItem Resource: !GetAtt Table.Arn GenerateLoadTestResults: Type: AWS::Serverless::Function Properties: CodeUri: ./GenerateLoadTestResults/ Handler: GenerateLoadTestResults::GenerateLoadTestResults.Function::FunctionHandler Runtime: dotnet6 Events: Api: Type: HttpApi Properties: Path: /test-results Method: GET Environment: Variables: LOG_GROUP_PREFIX: !Sub "/aws/lambda/net-31-base-" LOAD_TEST_TYPE: "NET 3.1" LAMBDA_ARCHITECTURE: !Ref LambdaArchitecture Policies: - Version: "2012-10-17" Statement: - Sid: AllowStartQueries Effect: Allow Action: - logs:DescribeLogGroups - logs:StartQuery Resource: "*" - Sid: AllowGetQueryResults Effect: Allow Action: logs:GetQueryResults Resource: "*" Table: Type: AWS::DynamoDB::Table Properties: AttributeDefinitions: - AttributeName: id AttributeType: S BillingMode: PAY_PER_REQUEST KeySchema: - AttributeName: id KeyType: HASH StreamSpecification: StreamViewType: NEW_AND_OLD_IMAGES Outputs: ApiUrl: Description: "API Gateway endpoint URL" Value: !Sub "https://${ServerlessHttpApi}.execute-api.${AWS::Region}.amazonaws.com/"