-
Notifications
You must be signed in to change notification settings - Fork 102
/
template.yaml
59 lines (53 loc) · 1.37 KB
/
template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: AWS-SAM-APIGW-Lambda-DDB
Globals:
Function:
Runtime: java11
MemorySize: 1024
Timeout: 25
Api:
OpenApiVersion: '3.0.1'
Resources:
#Ticket API Gateway
#Stage name: dev
ticketAPIGateway:
Type: AWS::Serverless::Api
Properties:
StageName: dev
Name: ticket-api-gateway
TracingEnabled: true
#Ticket Lambda Function
ticketLambdaPublisher:
Type: AWS::Serverless::Function
Properties:
FunctionName: ticketPublisher
Handler: com.example.TicketFunction::handleRequest
CodeUri: TicketsFunction
Tracing: Active
Environment:
Variables:
JAVA_TOOL_OPTIONS: -XX:+TieredCompilation -XX:TieredStopAtLevel=1
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref ticketDDBTable
Events:
ApiEvents:
Type: Api
Properties:
Path: /ticket
Method: POST
RestApiId: !Ref ticketAPIGateway
#Ticket DynamoDB table
ticketDDBTable:
Type: AWS::Serverless::SimpleTable
Properties:
TableName: tickets
PrimaryKey:
Name: ticketId
Type: String
Outputs:
ApiEndpoint:
Description: API Gateway Ticket Endpoint
Value:
Fn::Sub: https://${ticketAPIGateway}.execute-api.${AWS::Region}.amazonaws.com/dev