-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.ts
More file actions
90 lines (87 loc) · 1.66 KB
/
serverless.ts
File metadata and controls
90 lines (87 loc) · 1.66 KB
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
import type { Serverless } from "serverless/aws";
const serverlessConfiguration: Serverless = {
service: {
name: "sls-api-ts",
// app and org for use with dashboard.serverless.com
// app: your-app-name,
// org: your-org-name,
},
frameworkVersion: "2",
custom: {
webpack: {
webpackConfig: "./webpack.config.js",
includeModules: true,
},
s3Sync: [
{
bucketName: "sls-api-ts-bucket-10091986",
localDir: "S3",
},
],
tableName: "SlsApiTs-Customers",
},
// Add the serverless-webpack plugin
plugins: ["serverless-webpack", "serverless-s3-sync"],
provider: {
name: "aws",
runtime: "nodejs14.x",
apiGateway: {
minimumCompressionSize: 1024,
},
environment: {
AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1",
TEST: "${opt:stage, 'dev'}",
TABLE_NAME: "${self:custom.tableName}",
},
iamRoleStatements: [
{
Effect: "Allow",
Action: ["dynamodb:*"],
Resource: "*",
},
],
},
functions: {
home: {
handler: "lambda-functions/starting.home",
events: [
{
http: {
method: "get",
path: "/",
},
},
],
},
},
resources: {
Resources: {
SlSApiTsBucket: {
Type: "AWS::S3::Bucket",
Properties: {
BucketName: "sls-api-ts-bucket-10091986",
},
},
SlsApiTsDynamoDB: {
Type: "AWS::DynamoDB::Table",
Properties: {
TableName: "${self:custom.tableName}",
AttributeDefinitions: [
{
AttributeName: "ID",
AttributeType: "S",
},
],
KeySchema: [
{
AttributeName: "ID",
KeyType: "HASH",
},
],
BillingMode: "PAY_PER_REQUEST",
},
},
},
},
};
module.exports = serverlessConfiguration;