-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhelp.txt
157 lines (119 loc) · 6.07 KB
/
help.txt
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
open ~/.aws
mkdir notes
cd notes
npx serverless create --template aws-nodejs
serverless create -t aws-nodejs
npm init -y
touch .gitignore
npm i --save-dev @types/aws-lambda
https://www.serverless.com/plugins/serverless-plugin-typescript
npm i @types/aws-lambda
serverless deploy
serverless deploy -f createAuction -v
serverless logs -f createAuction
serverless logs -f getAuctions
Some ways to optimize AWS Lambda function performance include
choosing the right memory allocation, limiting the number of
modules imported, minimizing network latency, and reducing the initial startup time.
// serverless deploy function --function getAuctions
// serverless logs -f getAuctions -t
// serverless logs -f processAuctions -t
// serverless logs -f processAuctions --startTime 1m
// serverless logs -f processAuctions --startTime 1h
// serverless invoke -f processAuctions -l
// with -l u will get logs of invoked function
// createAuction
// serverless logs -f createAuction -t
// serverless deploy function --function processAuctions
curl --location --request POST 'https://dev-mtzrfmcr246svjn6.us.auth0.com/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=ky4C6XXzXQhXHNnnPh9iDJqo6QW59zPV' \
--data-urlencode '[email protected]' \
--data-urlencode 'password=testing1234!' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'scope=openid'
{
"nickname": "sehrishwaheed98",
"name": "[email protected]",
"picture": "https://s.gravatar.com/avatar/f2ec43d44b79520fb880f0b00b1f62b9?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fse.png",
"updated_at": "2023-05-01T14:25:06.173Z",
"email": "[email protected]",
"email_verified": true,
"iss": "https://dev-mtzrfmcr246svjn6.us.auth0.com/",
"aud": "ky4C6XXzXQhXHNnnPh9iDJqo6QW59zPV",
"iat": 1682951106,
"exp": 1682987106,
"sub": "auth0|641e11cff939365a568f0faf"
}
"indentRainbow.includedLanguages": ["python", "yaml", "yml", "nim", "nims"]
serverless deploy --stage prod
npm i --save-dev serverless-iam-roles-per-function
serverless logs -f getAllNotes
serverless logs -f authorizer
serverless logs -f createNote
serverless logs -f deleteNote
serverless logs -f updateNote
serverless logs -f putEvents
serverless logs -f checkInventory
serverless logs -f sqsWorker
https://github.com/mjzone/lambda-error-emails/blob/master/logging/handler.js
serverless package --package my-artifact --stage dev
An auction API is typically used as part of an online auction website or platform to support buying and selling of goods, services or products through an auction process. Here are some of the key features that an auction API could include:
Bidding and auction management: The API should allow users to place bids on items and track the status of the auctions they participate in. The API should also allow auction managers to update auction details, such as minimum bids or auction end times.
Notifications: The API should allow users to receive notifications about the status of auctions they are interested in. This could include emails for winning or losing bids, notifications for new items up for auction, and updates on ending times for auctions.
Payment processing: The API could include integration with payment gateways to process payments for items sold through auctions.
Fraud prevention: The API could include fraud prevention features such as validation of user identities, and monitoring for suspicious activity or bidding patterns.
Data Analytics: The API could provide reporting and analytics features to help auction managers track performance and gather insights into user behavior.
Customization: An auction API should allow customization of the auction experience to meet the specific needs of the platform or client using it.
Overall, a well-designed auction API can provide a powerful tool for managing online auctions and delivering a seamless user experience for buyers and sellers alike.
https://github.com/mjzone/large-payload-handling/tree/master
1) serverless-jetpack (For Lambda Functions packaging with typescript)
2) Create a layer folder in src or outside
3) Create a layer lambda according to serverless framework
4) Go to layer folder example: src/layers/logging/nodejs/node_modules/logging
5) run tsc index.ts
6) It will generate index.js
7) Go to tsconfig.json
8) Add line => "include": ["src/**/*.ts", "src/layers/**/node_modules/**/*"]
9) It will include those node_modules while compiling
15) Use the plugin - serverless-layers, It attaches automatically layers to the provider and for each function
16) And add
provider:
deploymentBucket:
name: notes-service-dev-serverlessdeploymentbucket-1fvto0n6ho805
in the provider of your serverless.yml
17) Check your .serverless/logging
18) Unzip it and check the node_modules path
19) In our case its nodejs/node_modules which contains our folder logging
18) put it in the environment of the function
19) NODE_PATH: "./:/opt/nodejs/node_modules"
20) It works event without specifying NODE_PATH
21) https://www.shawntorsitano.com/2022/06/19/creating-lambda-layers-with-typescript-and-cdk-the-right-way/
22) In tsconfig.json
23) Add this in tsconfig.json
"paths": {
"logging": ["./src/layers/logging/nodejs/node_modules/logging"],
"/opt/nodejs/node_modules/logging": [
"./src/layers/logging/nodejs/node_modules/logging"
]
}
// the following steps should not be done rather add paths in tsconfig.json
10) Create a folder src/@types
11) Make a file logging.d.ts
12) logging refers to your module name here my module name is logging so I used it
13) declare your module
14) declare module "logging" {
export default function log<T>(event: T): Promise<{
statusCode: number;
body: string;
}>;
}
1) serverless-domain-manager for domain for api gateway
example in notes service
2) and then customDomain in custom variables
3) Create health check
4) healthCheckId from AWS::Route53::HealthCheck
5) and infra service has certificate manager for this domain
Serverless caching using momentum
cdk init --language=typescript app
git rm -r --cached .