-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
92 lines (88 loc) · 2.46 KB
/
serverless.yml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
service: test-appsync
provider:
name: aws
runtime: nodejs18.x
deploymentBucket:
name: testbucket
resources:
Resources:
DDBTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: table1
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
BillingMode: PAY_PER_REQUEST
RDSCluster:
Type: AWS::RDS::DBCluster
Properties:
DatabaseName: ${self:custom.rds.dbname}
Engine: aurora-postgresql
DBClusterIdentifier: ${self:custom.rds.dbcluster}
MasterUsername: ${self:custom.rds.username}
MasterUserPassword: ${self:custom.rds.password}
RDSDatabaseSecret:
Type: AWS::SecretsManager::Secret
Properties:
Name: rds-db-secret
SecretString: ${self:custom.rds.password}
custom:
rds:
dbcluster: c1
dbname: testappsync
username: testuser
password: testpass
appSync:
name: test-api
schema: schema.graphql
authenticationType: API_KEY
dataSources:
- type: AMAZON_DYNAMODB
name: ds_ddb
description: DynamoDB data source
config:
tableName: { Ref: DDBTable }
- type: RELATIONAL_DATABASE
name: ds_rds
description: RDS data source
config:
databaseName: ${self:custom.rds.dbname}
dbClusterIdentifier: ${self:custom.rds.dbcluster}
awsSecretStoreArn: { Ref: RDSDatabaseSecret }
mappingTemplatesLocation: ./templates
mappingTemplates:
# mapping templates for DynamoDB data source
- type: Mutation
field: addPostDDB
dataSource: ds_ddb
request: ddb.PutItem.request.vlt
response: ddb.PutItem.response.vlt
- type: Query
field: getPostsDDB
dataSource: ds_ddb
request: ddb.Scan.request.vlt
response: ddb.Scan.response.vlt
# mapping templates for RDS Aurora data source
- type: Mutation
field: addPostRDS
dataSource: ds_rds
request: rds.insert.request.vlt
response: rds.insert.response.vlt
- type: Query
field: getPostsRDS
dataSource: ds_rds
request: rds.select.request.vlt
response: rds.select.response.vlt
localstack:
stages:
- local
endpoints:
AppSync: http://localhost:4605
plugins:
- serverless-localstack
- serverless-appsync-plugin
- serverless-deployment-bucket