-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstructions.txt
222 lines (189 loc) · 7.02 KB
/
instructions.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
########## 01.06.2020
bash-3.2$ aws lambda add-permission --function-name users --statement-id 461c4f4d-6df3-4795-954b-90502c62be2e --action lambda:InvokeFunction --principal apigateway.amazonaws.com --source-arn arn:aws:execute-api:eu-west-2:849537040301:o4y8qlpi12/*/*/*
{
"Statement": "{\"Sid\":\"461c4f4d-6df3-4795-954b-90502c62be2e\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"apigateway.amazonaws.com\"},\"Action\":\"lambda:InvokeFunction\",\"Resource\":\"arn:aws:lambda:eu-west-2:849537040301:function:users\",\"Condition\":{\"ArnLike\":{\"AWS:SourceArn\":\"arn:aws:execute-api:eu-west-2:849537040301:o4y8qlpi12/*/*/*\"}}}"
}
iom@Oanas-MBP~/g/s/g/o/users> aws apigateway create-deployment --rest-api-id o4y8qlpi12 --stage-name staging
{
"id": "tk1vnq",
"createdDate": "2020-06-01T21:38:39+01:00"
}
########## 31.05.2020
iom@Oanas-MBP~/g/s/g/o/users> aws apigateway create-rest-api --name users
{
"id": "o4y8qlpi12",
"name": "users",
"createdDate": "2020-05-31T23:51:02+01:00",
"apiKeySource": "HEADER",
"endpointConfiguration": {
"types": [
"EDGE"
]
}
}
iom@Oanas-MBP~/g/s/g/o/users> aws apigateway get-resources --rest-api-id o4y8qlpi12
{
"items": [
{
"id": "tc7dxslcza",
"path": "/"
}
]
}
iom@Oanas-MBP~/g/s/g/o/users> aws apigateway create-resource --rest-api-id o4y8qlpi12 --parent-id tc7dxslcza --path-part users
{
"id": "8ndr4b",
"parentId": "tc7dxslcza",
"pathPart": "users",
"path": "/users"
}
iom@Oanas-MBP~/g/s/g/o/users> aws apigateway put-method --rest-api-id o4y8qlpi12 --resource-id 8ndr4b --http-method ANY --authorization-type NONE
{
"httpMethod": "ANY",
"authorizationType": "NONE",
"apiKeyRequired": false
}
arn:aws:apigateway:eu-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-2:849537040301:function:users/invocations
iom@Oanas-MBP~/g/s/g/o/users> aws apigateway put-integration --rest-api-id o4y8qlpi12 --resource-id 8ndr4b --http-method ANY --type AWS_PROXY --integration-http-method POST --uri arn:aws:apigateway:eu-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-2:849537040301:function:users/invocations
{
"type": "AWS_PROXY",
"httpMethod": "POST",
"uri": "arn:aws:apigateway:eu-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-2:849537040301:function:users/invocations",
"passthroughBehavior": "WHEN_NO_MATCH",
"timeoutInMillis": 29000,
"cacheNamespace": "8ndr4b",
"cacheKeyParameters": []
}
########## 28.05.2020
iom@Oanas-MBP~/g/s/g/o/users> aws dynamodb create-table --table-name Users --attribute-definitions AttributeName=ID,AttributeType=S --key-schema AttributeName=ID,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
{
"TableDescription": {
"AttributeDefinitions": [
{
"AttributeName": "ID",
"AttributeType": "S"
}
],
"TableName": "Users",
"KeySchema": [
{
"AttributeName": "ID",
"KeyType": "HASH"
}
],
"TableStatus": "CREATING",
"CreationDateTime": "2020-05-28T21:56:31.989000+01:00",
"ProvisionedThroughput": {
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 5
},
:...skipping...
{
"TableDescription": {
"AttributeDefinitions": [
{
"AttributeName": "ID",
"AttributeType": "S"
}
],
"TableName": "Users",
"KeySchema": [
{
"AttributeName": "ID",
"KeyType": "HASH"
}
],
"TableStatus": "CREATING",
"CreationDateTime": "2020-05-28T21:56:31.989000+01:00",
"ProvisionedThroughput": {
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 5
},
"TableSizeBytes": 0,
"ItemCount": 0,
"TableArn": "arn:aws:dynamodb:eu-west-2:849537040301:table/Users",
"TableId": "1edbf980-9ac9-4612-84c0-e025df6bf1da"
}
}
############# 26.05.2020
iom@Oanas-MBP~/g/s/g/o/users> aws iam create-role --role-name lambda-users-executor --assume-role-policy-document file:///Users/iom/go/src/github.com/oanaOM/users/trust-policy.json
{
"Role": {
"Path": "/",
"RoleName": "lambda-users-executor",
"RoleId": "AROA4LTC2P6W6LRNETSEQ",
"Arn": "arn:aws:iam::849537040301:role/lambda-users-executor",
"CreateDate": "2020-05-26T21:53:23+00:00",
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
}
}
####################
iom@Oanas-MBP~/g/s/g/o/users> aws lambda create-function --function-name users --runtime go1.x --role arn:aws:iam::849537040301:role/lambda-users-executor --handler main --zip-file fileb:///Users/iom/go/src/github.com/oanaOM/users/main.zip
{
"FunctionName": "users",
"FunctionArn": "arn:aws:lambda:eu-west-2:849537040301:function:users",
"Runtime": "go1.x",
"Role": "arn:aws:iam::849537040301:role/lambda-users-executor",
"Handler": "main",
"CodeSize": 5026898,
"Description": "",
"Timeout": 3,
"MemorySize": 128,
"LastModified": "2020-05-26T21:58:52.225+0000",
"CodeSha256": "xaOfQPT4lKwD5EfZFT7FgMe0NomShnu8pB9RFDUhce4=",
"Version": "$LATEST",
"TracingConfig": {
"Mode": "PassThrough"
},
"RevisionId": "cbc592fa-db76-4566-827b-dac923ee1324",
"State": "Active",
"LastUpdateStatus": "Successful"
}
##########################################
iom@Oanas-MBP~/g/s/g/o/users> aws lambda invoke --function-name users output.json
{
"StatusCode": 200,
"ExecutedVersion": "$LATEST"
}
iom@Oanas-MBP~/g/s/g/o/users> aws dynamodb create-table --table-name Users --attribute-definitions AttributeName=ID,AttributeType=N --key-schema AttributeName=ID,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
{
"TableDescription": {
"AttributeDefinitions": [
{
"AttributeName": "ID",
"AttributeType": "N"
}
],
"TableName": "Users",
"KeySchema": [
{
"AttributeName": "ID",
"KeyType": "HASH"
}
],
"TableStatus": "CREATING",
"CreationDateTime": "2020-05-26T23:11:46.769000+01:00",
"ProvisionedThroughput": {
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 5
},
"TableSizeBytes": 0,
"ItemCount": 0,
"TableArn": "arn:aws:dynamodb:eu-west-2:849537040301:table/Users",
"TableId": "4eb1b3b0-6416-45ec-afef-061d1d7879c2"
}
}