@gugananuvem/aws-local-simulator 1.0.11 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +349 -72
  2. package/package.json +12 -2
  3. package/src/config/config-loader.js +2 -0
  4. package/src/config/default-config.js +3 -0
  5. package/src/index.js +18 -2
  6. package/src/server.js +37 -31
  7. package/src/services/apigateway/index.js +10 -3
  8. package/src/services/apigateway/server.js +73 -0
  9. package/src/services/apigateway/simulator.js +13 -3
  10. package/src/services/athena/index.js +75 -0
  11. package/src/services/athena/server.js +101 -0
  12. package/src/services/athena/simulador.js +998 -0
  13. package/src/services/athena/simulator.js +346 -0
  14. package/src/services/cloudformation/index.js +106 -0
  15. package/src/services/cloudformation/server.js +417 -0
  16. package/src/services/cloudformation/simulador.js +1045 -0
  17. package/src/services/cloudtrail/index.js +84 -0
  18. package/src/services/cloudtrail/server.js +235 -0
  19. package/src/services/cloudtrail/simulador.js +719 -0
  20. package/src/services/cloudwatch/index.js +84 -0
  21. package/src/services/cloudwatch/server.js +366 -0
  22. package/src/services/cloudwatch/simulador.js +1173 -0
  23. package/src/services/cognito/index.js +5 -0
  24. package/src/services/cognito/server.js +54 -3
  25. package/src/services/cognito/simulator.js +273 -2
  26. package/src/services/config/index.js +96 -0
  27. package/src/services/config/server.js +215 -0
  28. package/src/services/config/simulador.js +1260 -0
  29. package/src/services/dynamodb/index.js +7 -3
  30. package/src/services/dynamodb/server.js +4 -2
  31. package/src/services/dynamodb/simulator.js +39 -29
  32. package/src/services/eventbridge/index.js +55 -51
  33. package/src/services/eventbridge/server.js +209 -0
  34. package/src/services/eventbridge/simulator.js +684 -0
  35. package/src/services/index.js +30 -4
  36. package/src/services/kms/index.js +75 -0
  37. package/src/services/kms/server.js +67 -0
  38. package/src/services/kms/simulator.js +324 -0
  39. package/src/services/lambda/handler-loader.js +13 -2
  40. package/src/services/lambda/index.js +7 -1
  41. package/src/services/lambda/server.js +32 -39
  42. package/src/services/lambda/simulator.js +78 -181
  43. package/src/services/parameter-store/index.js +80 -0
  44. package/src/services/parameter-store/server.js +50 -0
  45. package/src/services/parameter-store/simulator.js +201 -0
  46. package/src/services/s3/index.js +7 -3
  47. package/src/services/s3/server.js +20 -13
  48. package/src/services/s3/simulator.js +163 -407
  49. package/src/services/secret-manager/index.js +80 -0
  50. package/src/services/secret-manager/server.js +50 -0
  51. package/src/services/secret-manager/simulator.js +171 -0
  52. package/src/services/sns/index.js +55 -42
  53. package/src/services/sns/server.js +580 -0
  54. package/src/services/sns/simulator.js +1482 -0
  55. package/src/services/sqs/index.js +2 -4
  56. package/src/services/sqs/server.js +92 -18
  57. package/src/services/sqs/simulator.js +79 -298
  58. package/src/services/sts/index.js +37 -0
  59. package/src/services/sts/server.js +142 -0
  60. package/src/services/sts/simulator.js +69 -0
  61. package/src/services/xray/index.js +83 -0
  62. package/src/services/xray/server.js +308 -0
  63. package/src/services/xray/simulador.js +994 -0
  64. package/src/utils/cloudtrail-audit.js +129 -0
  65. package/src/utils/local-store.js +18 -2
package/README.md CHANGED
@@ -16,17 +16,30 @@ Simulador local completo para serviços AWS. Desenvolva e teste suas aplicaçõe
16
16
  | Lambda | ✅ | 3001 | Funções serverless |
17
17
  | Cognito | ✅ | 9229 | Autenticação e autorização |
18
18
  | API Gateway | ✅ | 4567 | APIs REST e HTTP |
19
- | ECS/Fargate | 🚧 | 8080 | Orquestração de containers (em desenvolvimento) |
20
- | SNS | 🚧 | 9911 | Notificações (em desenvolvimento) |
21
- | EventBridge | 🚧 | 4010 | Barramento de eventos (em desenvolvimento) |
19
+ | STS | | 9326 | Credenciais temporárias |
20
+ | SNS | | 9911 | Notificações pub/sub |
21
+ | EventBridge | | 4010 | Barramento de eventos |
22
+ | KMS | ✅ | 4000 | Gerenciamento de chaves |
23
+ | Secrets Manager | ✅ | 4001 | Gerenciamento de segredos |
24
+ | Parameter Store | ✅ | 4002 | Armazenamento de parâmetros |
25
+ | CloudWatch | ✅ | 4011 | Logs, métricas e alarmes |
26
+ | CloudTrail | ✅ | 4012 | Auditoria de API calls |
27
+ | AWS Config | ✅ | 4013 | Conformidade e configuração |
28
+ | CloudFormation | ✅ | 4580 | Infraestrutura como código |
29
+ | Athena | ✅ | 4599 | Consultas SQL em dados no S3 |
30
+ | X-Ray | ✅ | 4015 | Rastreamento distribuído |
31
+ | ECS/Fargate | 🚧 | 8080 | Orquestração de containers (em desenvolvimento) |
22
32
 
23
33
  ## 📦 Instalação
24
34
 
25
35
  ```bash
26
36
  npm install --save-dev aws-local-simulator
27
37
  ```
28
- 🚀 Uso Rápido
29
- 1. Crie um arquivo de configuração aws-local-simulator.json:
38
+
39
+ ## 🚀 Uso Rápido
40
+
41
+ ### 1. Crie um arquivo de configuração `aws-local-simulator.json`:
42
+
30
43
  ```json
31
44
  {
32
45
  "services": {
@@ -35,11 +48,23 @@ npm install --save-dev aws-local-simulator
35
48
  "sqs": true,
36
49
  "lambda": true,
37
50
  "cognito": true,
38
- "apigateway": true
51
+ "apigateway": true,
52
+ "sts": true,
53
+ "sns": true,
54
+ "eventbridge": true,
55
+ "kms": true,
56
+ "secret-manager": true,
57
+ "parameter-store": true,
58
+ "cloudwatch": true,
59
+ "cloudtrail": true,
60
+ "cloudformation": true,
61
+ "xray": true,
62
+ "config": true,
63
+ "athena": true
39
64
  },
40
65
  "lambdas": [
41
66
  {
42
- "path": "/api/users",
67
+ "name": "my-function",
43
68
  "handler": "./src/handlers/users.js",
44
69
  "env": {
45
70
  "TABLE_NAME": "users-table"
@@ -50,18 +75,17 @@ npm install --save-dev aws-local-simulator
50
75
  "tables": [
51
76
  {
52
77
  "TableName": "users-table",
53
- "KeySchema": [
54
- { "AttributeName": "id", "KeyType": "HASH" }
55
- ],
56
- "AttributeDefinitions": [
57
- { "AttributeName": "id", "AttributeType": "S" }
58
- ]
78
+ "KeySchema": [{ "AttributeName": "id", "KeyType": "HASH" }],
79
+ "AttributeDefinitions": [{ "AttributeName": "id", "AttributeType": "S" }]
59
80
  }
60
81
  ]
61
82
  },
62
83
  "s3": {
63
84
  "buckets": ["my-bucket"]
64
85
  },
86
+ "sqs": {
87
+ "queues": ["my-queue", "dead-letter-queue"]
88
+ },
65
89
  "cognito": {
66
90
  "userPools": [
67
91
  {
@@ -73,80 +97,119 @@ npm install --save-dev aws-local-simulator
73
97
  }
74
98
  ```
75
99
 
76
- # 2. Inicie o simulador:
77
- ## Via CLI
100
+ ### 2. Inicie o simulador:
101
+
102
+ ```bash
103
+ # Via CLI
78
104
  npx aws-local-simulator start
79
105
 
80
106
  # Ou via código
81
107
  const { AWSLocalSimulator } = require('aws-local-simulator');
82
108
  const simulator = new AWSLocalSimulator();
83
109
  await simulator.start();
110
+ ```
84
111
 
85
- # 3. Configure seu código para usar os serviços locais:
112
+ ### 3. Configure seu código para usar os serviços locais:
86
113
 
87
114
  ```javascript
88
- // Importe a configuração AWS pronta
89
- const { dynamoDB, s3, sqs, cognito, apigateway } = require('aws-local-simulator/aws-config');
115
+ const { dynamoDB, s3, sqs, cognito } = require('aws-local-simulator/aws-config');
90
116
 
91
- // Use como normalmente faria
92
117
  await dynamoDB.send(new PutCommand({
93
118
  TableName: 'users-table',
94
119
  Item: { id: '123', name: 'John' }
95
120
  }));
96
121
  ```
97
122
 
98
- 🔧 Configuração por Variáveis de Ambiente
123
+ ## 🔧 Configuração por Variáveis de Ambiente
99
124
 
100
125
  | Variável | Descrição | Padrão |
101
126
  |---------|----------|-------|
102
- | AWS_LOCAL_SIMULATOR_DYNAMODB |Habilita DynamoDB | true |
103
- | AWS_LOCAL_SIMULATOR_S3 |Habilita S3 | true |
104
- | AWS_LOCAL_SIMULATOR_SQS |Habilita SQS | true |
105
- | AWS_LOCAL_SIMULATOR_LAMBDA |Habilita Lambda | true |
106
- | AWS_LOCAL_SIMULATOR_COGNITO |Habilita Cognito | false |
107
- | AWS_LOCAL_SIMULATOR_APIGATEWAY |Habilita API Gateway | false |
108
- | AWS_LOCAL_SIMULATOR_ECS |Habilita ECS/Fargate | false |
109
- | AWS_LOCAL_SIMULATOR_DYNAMODB_PORT |Porta DynamoDB | 8000 |
110
- | AWS_LOCAL_SIMULATOR_S3_PORT |Porta S3 | 4566 |
111
- | AWS_LOCAL_SIMULATOR_SQS_PORT |Porta SQS | 9324 |
112
- | AWS_LOCAL_SIMULATOR_LAMBDA_PORT |Porta Lambda | 3001 |
113
- | AWS_LOCAL_SIMULATOR_COGNITO_PORT |Porta Cognito | 9229 |
114
- | AWS_LOCAL_SIMULATOR_APIGATEWAY_PORT |Porta API Gateway | 4567 |
115
- | AWS_LOCAL_SIMULATOR_ECS_PORT |Porta ECS | 8080 |
116
- | AWS_LOCAL_SIMULATOR_DATA |Diretório de dados | ./aws-local-simulator-data |
117
- | AWS_LOCAL_SIMULATOR_LOG |Nível de log | info |
118
- ```
127
+ | AWS_LOCAL_SIMULATOR_DYNAMODB | Habilita DynamoDB | true |
128
+ | AWS_LOCAL_SIMULATOR_S3 | Habilita S3 | true |
129
+ | AWS_LOCAL_SIMULATOR_SQS | Habilita SQS | true |
130
+ | AWS_LOCAL_SIMULATOR_LAMBDA | Habilita Lambda | true |
131
+ | AWS_LOCAL_SIMULATOR_COGNITO | Habilita Cognito | false |
132
+ | AWS_LOCAL_SIMULATOR_APIGATEWAY | Habilita API Gateway | false |
133
+ | AWS_LOCAL_SIMULATOR_STS | Habilita STS | true |
134
+ | AWS_LOCAL_SIMULATOR_SNS | Habilita SNS | false |
135
+ | AWS_LOCAL_SIMULATOR_EVENTBRIDGE | Habilita EventBridge | false |
136
+ | AWS_LOCAL_SIMULATOR_KMS | Habilita KMS | false |
137
+ | AWS_LOCAL_SIMULATOR_SECRET_MANAGER | Habilita Secrets Manager | false |
138
+ | AWS_LOCAL_SIMULATOR_PARAMETER_STORE | Habilita Parameter Store | false |
139
+ | AWS_LOCAL_SIMULATOR_CLOUDWATCH | Habilita CloudWatch | false |
140
+ | AWS_LOCAL_SIMULATOR_CLOUDTRAIL | Habilita CloudTrail | false |
141
+ | AWS_LOCAL_SIMULATOR_CLOUDFORMATION | Habilita CloudFormation | false |
142
+ | AWS_LOCAL_SIMULATOR_ATHENA | Habilita Athena | false |
143
+ | AWS_LOCAL_SIMULATOR_XRAY | Habilita X-Ray | false |
144
+ | AWS_LOCAL_SIMULATOR_CONFIG | Habilita AWS Config | false |
145
+ | AWS_LOCAL_SIMULATOR_ECS | Habilita ECS/Fargate | false |
146
+ | AWS_LOCAL_SIMULATOR_DYNAMODB_PORT | Porta DynamoDB | 8000 |
147
+ | AWS_LOCAL_SIMULATOR_S3_PORT | Porta S3 | 4566 |
148
+ | AWS_LOCAL_SIMULATOR_SQS_PORT | Porta SQS | 9324 |
149
+ | AWS_LOCAL_SIMULATOR_LAMBDA_PORT | Porta Lambda | 3001 |
150
+ | AWS_LOCAL_SIMULATOR_COGNITO_PORT | Porta Cognito | 9229 |
151
+ | AWS_LOCAL_SIMULATOR_APIGATEWAY_PORT | Porta API Gateway | 4567 |
152
+ | AWS_LOCAL_SIMULATOR_STS_PORT | Porta STS | 9326 |
153
+ | AWS_LOCAL_SIMULATOR_SNS_PORT | Porta SNS | 9911 |
154
+ | AWS_LOCAL_SIMULATOR_EVENTBRIDGE_PORT | Porta EventBridge | 4010 |
155
+ | AWS_LOCAL_SIMULATOR_KMS_PORT | Porta KMS | 4000 |
156
+ | AWS_LOCAL_SIMULATOR_SECRET_MANAGER_PORT | Porta Secrets Manager | 4001 |
157
+ | AWS_LOCAL_SIMULATOR_PARAMETER_STORE_PORT | Porta Parameter Store | 4002 |
158
+ | AWS_LOCAL_SIMULATOR_CLOUDWATCH_PORT | Porta CloudWatch | 4011 |
159
+ | AWS_LOCAL_SIMULATOR_CLOUDTRAIL_PORT | Porta CloudTrail | 4012 |
160
+ | AWS_LOCAL_SIMULATOR_CONFIG_PORT | Porta AWS Config | 4013 |
161
+ | AWS_LOCAL_SIMULATOR_XRAY_PORT | Porta X-Ray | 4015 |
162
+ | AWS_LOCAL_SIMULATOR_CLOUDFORMATION_PORT | Porta CloudFormation | 4580 |
163
+ | AWS_LOCAL_SIMULATOR_ATHENA_PORT | Porta Athena | 4599 |
164
+ | AWS_LOCAL_SIMULATOR_ECS_PORT | Porta ECS | 8080 |
165
+ | AWS_LOCAL_SIMULATOR_DATA | Diretório de dados | ./aws-local-simulator-data |
166
+ | AWS_LOCAL_SIMULATOR_LOG | Nível de log | info |
167
+
168
+ ## 📝 Comandos CLI
119
169
 
120
- # 📝 Comandos CLI
121
170
  ```bash
122
- #### Iniciar simulador
171
+ # Iniciar simulador
123
172
  npx aws-local-simulator start [configPath]
124
173
 
125
- #### Parar simulador
174
+ # Parar simulador
126
175
  npx aws-local-simulator stop
127
176
 
128
- #### Reiniciar
177
+ # Reiniciar
129
178
  npx aws-local-simulator restart
130
179
 
131
- #### Resetar dados
180
+ # Resetar dados
132
181
  npx aws-local-simulator reset
133
182
 
134
- #### Status
183
+ # Status
135
184
  npx aws-local-simulator status
136
185
  ```
137
186
 
138
- # 🔌 Endpoints
187
+ ## 🔌 Endpoints
188
+
139
189
  | Serviço | Endpoint | Admin |
140
190
  |---------|----------|-------|
141
- | DynamoDB | http://localhost:8000 | http://localhost:8000/__admin/tables |
142
- | S3 | http://localhost:4566 | http://localhost:4566/__admin/buckets |
143
- | SQS | http://localhost:9324 | http://localhost:9324/__admin/queues |
144
- | Lambda | http://localhost:3001 | http://localhost:3001/__admin/functions |
145
- | Cognito | http://localhost:9229 | http://localhost:9229/__admin/userpools |
146
- | API Gateway | http://localhost:4567 | http://localhost:4567/__admin/apis |
147
- | ECS | http://localhost:8080 | http://localhost:8080/__admin/clusters |
148
-
149
- 🧪 Testando com AWS CLI
191
+ | DynamoDB | http://localhost:8000 | http://localhost:8000/__admin/tables |
192
+ | S3 | http://localhost:4566 | http://localhost:4566/__admin/buckets |
193
+ | SQS | http://localhost:9324 | http://localhost:9324/__admin/queues |
194
+ | Lambda | http://localhost:3001 | http://localhost:3001/__admin/functions |
195
+ | Cognito | http://localhost:9229 | http://localhost:9229/__admin/userpools |
196
+ | API Gateway | http://localhost:4567 | http://localhost:4567/__admin/apis |
197
+ | STS | http://localhost:9326 | |
198
+ | SNS | http://localhost:9911 | http://localhost:9911/__admin/health |
199
+ | EventBridge | http://localhost:4010 | — |
200
+ | KMS | http://localhost:4000 | — |
201
+ | Secrets Manager | http://localhost:4001 | — |
202
+ | Parameter Store | http://localhost:4002 | — |
203
+ | CloudWatch | http://localhost:4011 | — |
204
+ | CloudTrail | http://localhost:4012 | — |
205
+ | AWS Config | http://localhost:4013 | — |
206
+ | X-Ray | http://localhost:4015 | — |
207
+ | CloudFormation | http://localhost:4580 | http://localhost:4580/__admin/stacks |
208
+ | Athena | http://localhost:4599 | http://localhost:4599/__admin/health |
209
+ | ECS | http://localhost:8080 | http://localhost:8080/__admin/clusters |
210
+
211
+ ## 🧪 Testando com AWS CLI
212
+
150
213
  ```bash
151
214
  # DynamoDB
152
215
  aws dynamodb list-tables --endpoint-url http://localhost:8000
@@ -157,14 +220,221 @@ aws s3 ls --endpoint-url http://localhost:4566
157
220
  # SQS
158
221
  aws sqs list-queues --endpoint-url http://localhost:9324
159
222
 
223
+ # Lambda
224
+ aws lambda invoke \
225
+ --function-name my-function \
226
+ --payload '{"key":"value"}' \
227
+ --endpoint-url http://localhost:3001 \
228
+ output.json
229
+
160
230
  # Cognito
161
231
  aws cognito-idp list-user-pools --max-results 10 --endpoint-url http://localhost:9229
162
232
 
233
+ # STS
234
+ aws sts get-caller-identity --endpoint-url http://localhost:9326
235
+ aws sts assume-role \
236
+ --role-arn "arn:aws:iam::123456789012:role/my-role" \
237
+ --role-session-name "my-session" \
238
+ --endpoint-url http://localhost:9326
239
+
240
+ # SNS
241
+ aws sns list-topics --endpoint-url http://localhost:9911
242
+
243
+ # EventBridge
244
+ aws events list-event-buses --endpoint-url http://localhost:4010
245
+
246
+ # KMS
247
+ aws kms list-keys --endpoint-url http://localhost:4000
248
+
249
+ # Secrets Manager
250
+ aws secretsmanager list-secrets --endpoint-url http://localhost:4001
251
+
252
+ # Criar secret
253
+ aws secretsmanager create-secret \
254
+ --name "local/app/db-credentials" \
255
+ --description "Credenciais do banco" \
256
+ --secret-string '{"username":"admin","password":"secret123"}' \
257
+ --endpoint-url http://localhost:4001
258
+
259
+ # Ler secret
260
+ aws secretsmanager get-secret-value \
261
+ --secret-id "local/app/db-credentials" \
262
+ --endpoint-url http://localhost:4001
263
+
264
+ # Parameter Store
265
+ aws ssm describe-parameters --endpoint-url http://localhost:4002
266
+
267
+ # Criar parâmetro String
268
+ aws ssm put-parameter \
269
+ --name "/local/app/config" \
270
+ --value '{"timeout":30,"maxRetries":3}' \
271
+ --type String \
272
+ --endpoint-url http://localhost:4002
273
+
274
+ # Criar parâmetro SecureString
275
+ aws ssm put-parameter \
276
+ --name "/local/app/api-key" \
277
+ --value "my-secret-api-key" \
278
+ --type SecureString \
279
+ --endpoint-url http://localhost:4002
280
+
281
+ # Ler parâmetro
282
+ aws ssm get-parameter \
283
+ --name "/local/app/config" \
284
+ --endpoint-url http://localhost:4002
285
+
286
+ # CloudWatch
287
+ aws cloudwatch list-metrics --endpoint-url http://localhost:4011
288
+ aws logs describe-log-groups --endpoint-url http://localhost:4011
289
+
290
+ # CloudTrail
291
+ aws cloudtrail describe-trails --endpoint-url http://localhost:4012
292
+
293
+ # CloudFormation
294
+ aws cloudformation list-stacks --endpoint-url http://localhost:4580
295
+
296
+ # X-Ray
297
+ aws xray get-trace-summaries \
298
+ --start-time $(date -d '1 hour ago' +%s) \
299
+ --end-time $(date +%s) \
300
+ --endpoint-url http://localhost:4015
301
+
302
+ # AWS Config
303
+ aws configservice describe-configuration-recorders --endpoint-url http://localhost:4013
304
+
163
305
  # API Gateway
164
306
  aws apigateway get-rest-apis --endpoint-url http://localhost:4567
307
+
308
+ # Cloudformation
309
+ aws cloudformation create-stack \
310
+ --stack-name test-stack \
311
+ --template-body file://templates/test-stack.yaml \
312
+ --parameters \
313
+ ParameterKey=Environment,ParameterValue=local \
314
+ ParameterKey=BucketName,ParameterValue=meu-bucket \
315
+ ParameterKey=QueueName,ParameterValue=minha-fila \
316
+ ParameterKey=TableName,ParameterValue=minha-tabela \
317
+ --endpoint-url http://localhost:4580
318
+
319
+ # Ver Cloudformation resultado
320
+ aws cloudformation describe-stacks \
321
+ --stack-name test-stack \
322
+ --endpoint-url http://localhost:4580
323
+
324
+ # Athena
325
+ # Criar workgroup
326
+ aws athena create-work-group \
327
+ --name my-workgroup \
328
+ --configuration ResultConfiguration={OutputLocation=s3://meu-bucket/athena-results/} \
329
+ --endpoint-url http://localhost:4599
330
+
331
+ # Listar workgroups
332
+ aws athena list-work-groups --endpoint-url http://localhost:4599
333
+
334
+ # Executar query
335
+ aws athena start-query-execution \
336
+ --query-string "SELECT * FROM my_table LIMIT 10" \
337
+ --query-execution-context Database=default \
338
+ --result-configuration OutputLocation=s3://meu-bucket/athena-results/ \
339
+ --endpoint-url http://localhost:4599
340
+
341
+ # Verificar status da query
342
+ aws athena get-query-execution \
343
+ --query-execution-id <id-retornado> \
344
+ --endpoint-url http://localhost:4599
345
+
346
+ # Buscar resultados
347
+ aws athena get-query-results \
348
+ --query-execution-id <id-retornado> \
349
+ --endpoint-url http://localhost:4599
350
+
351
+ # Criar named query
352
+ aws athena create-named-query \
353
+ --name "my-saved-query" \
354
+ --database default \
355
+ --query-string "SELECT id, value FROM my_table WHERE status = 'active'" \
356
+ --endpoint-url http://localhost:4599
357
+
358
+ # Listar named queries
359
+ aws athena list-named-queries --endpoint-url http://localhost:4599
360
+ ```
361
+
362
+ ## ⚙️ Configuração de Lambdas
363
+
364
+ Lambdas são registradas por **nome** e invocadas via API de invocação (igual à AWS real). O roteamento HTTP é feito pelo API Gateway.
365
+
366
+ ```json
367
+ {
368
+ "lambdas": [
369
+ {
370
+ "name": "my-user-function",
371
+ "handler": "./src/handlers/my-user-function.js",
372
+ "env": {
373
+ "TABLE_NAME": "users-table",
374
+ "BUCKET_NAME": "my-bucket"
375
+ }
376
+ }
377
+ ]
378
+ }
379
+ ```
380
+
381
+ ## ⚙️ Configuração API GATEWAY
382
+
383
+ O valor do **lambdaName** deve igual ao nome Lambda que está registrada com o valor **name**. Ex: "my-user-function".
384
+
385
+ ```json
386
+ {
387
+ "apigateway": {
388
+ "apis": [
389
+ {
390
+ "name": "Users API",
391
+ "description": "API para gerenciamento de usuários",
392
+ "endpoints": [
393
+ {
394
+ "path": "/user",
395
+ "method": "GET",
396
+ "lambdaName": "my-user-function",
397
+ "integrationType": "lambda"
398
+ },
399
+ {
400
+ "path": "/user",
401
+ "method": "POST",
402
+ "lambdaName": "my-user-function",
403
+ "integrationType": "lambda"
404
+ },
405
+ {
406
+ "path": "/user/{id}",
407
+ "method": "GET",
408
+ "lambdaName": "my-user-function",
409
+ "integrationType": "lambda"
410
+ },
411
+ {
412
+ "path": "/user/{id}",
413
+ "method": "DELETE",
414
+ "lambdaName": "my-user-function",
415
+ "integrationType": "lambda"
416
+ }
417
+ ]
418
+ }
419
+ ]
420
+ },
421
+
422
+ }
423
+ ```
424
+
425
+ O handler deve exportar uma função padrão:
426
+
427
+ ```javascript
428
+ exports.handler = async (event, context) => {
429
+ return {
430
+ statusCode: 200,
431
+ body: JSON.stringify({ message: 'Hello from Lambda!' })
432
+ };
433
+ };
165
434
  ```
166
435
 
167
- 📁 Estrutura de Dados
436
+ ## 📁 Estrutura de Dados
437
+
168
438
  Os dados são persistidos em:
169
439
 
170
440
  ```text
@@ -174,31 +444,38 @@ Os dados são persistidos em:
174
444
  ├── sqs/
175
445
  ├── cognito/
176
446
  ├── apigateway/
177
- └── ecs/
447
+ ├── ecs/
448
+ ├── kms/
449
+ ├── secret-manager/
450
+ ├── parameter-store/
451
+ ├── cloudwatch/
452
+ ├── cloudtrail/
453
+ ├── cloudformation/
454
+ ├── athena/
455
+ ├── xray/
456
+ └── config/
178
457
  ```
179
458
 
180
- 🐛 Debug
181
- Para logs detalhados:
182
-
183
- bash
184
- AWS_LOCAL_SIMULATOR_LOG=verboso npx aws-local-simulator start
185
- 🤝 Contribuindo
186
- Fork o projeto
459
+ ## 🐛 Debug
187
460
 
188
- Crie sua feature branch (git checkout -b feature/AmazingFeature)
461
+ ```bash
462
+ AWS_LOCAL_SIMULATOR_LOG=verbose npx aws-local-simulator start
463
+ ```
189
464
 
190
- Commit suas mudanças (git commit -m 'Add some AmazingFeature')
465
+ ## 🤝 Contribuindo
191
466
 
192
- Push para a branch (git push origin feature/AmazingFeature)
467
+ 1. Fork o projeto
468
+ 2. Crie sua feature branch (`git checkout -b feature/AmazingFeature`)
469
+ 3. Commit suas mudanças (`git commit -m 'Add some AmazingFeature'`)
470
+ 4. Push para a branch (`git push origin feature/AmazingFeature`)
471
+ 5. Abra um Pull Request
193
472
 
194
- Abra um Pull Request
473
+ ## 📄 Licença
195
474
 
196
- 📄 Licença
197
475
  MIT © Luiz Gustavo Ribeiro
198
476
 
199
- ⚠️ Limitações
200
- SNS e EventBridge em desenvolvimento
201
-
202
- WebSocket APIs em desenvolvimento
477
+ ## ⚠️ Limitações
203
478
 
204
- Para uso em desenvolvimento e testes apenas
479
+ - ECS/Fargate em desenvolvimento
480
+ - WebSocket APIs em desenvolvimento
481
+ - Para uso em desenvolvimento e testes apenas
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gugananuvem/aws-local-simulator",
3
- "version": "1.0.11",
3
+ "version": "1.0.14",
4
4
  "description": "Simulador local completo para serviços AWS",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -45,7 +45,17 @@
45
45
  "lambda",
46
46
  "cognito",
47
47
  "apigateway",
48
+ "kms",
49
+ "config",
50
+ "parameter-store",
51
+ "secret-manager",
52
+ "cloudformation",
53
+ "eventbridge",
54
+ "sns",
48
55
  "ecs",
56
+ "sts",
57
+ "cloudtrail",
58
+ "cloudwatch",
49
59
  "development",
50
60
  "testing"
51
61
  ],
@@ -109,6 +119,6 @@
109
119
  "optional": true
110
120
  }
111
121
  },
112
- "buildDate": "2026-04-03T22:32:50.683Z",
122
+ "buildDate": "2026-04-05T12:32:46.437Z",
113
123
  "published": true
114
124
  }
@@ -23,6 +23,7 @@ class ConfigLoader {
23
23
  if (configPath) {
24
24
  const userConfig = await this.loadUserConfig(configPath);
25
25
  config = this.mergeDeep(config, userConfig);
26
+ config._configPath = path.resolve(process.cwd(), configPath);
26
27
  } else {
27
28
  // Tenta encontrar arquivo de configuração padrão
28
29
  const possiblePaths = [
@@ -35,6 +36,7 @@ class ConfigLoader {
35
36
  if (fs.existsSync(possiblePath)) {
36
37
  const userConfig = await this.loadUserConfig(possiblePath);
37
38
  config = this.mergeDeep(config, userConfig);
39
+ config._configPath = possiblePath;
38
40
  logger.info(`✅ Configuração carregada de: ${possiblePath}`);
39
41
  break;
40
42
  }
@@ -14,6 +14,7 @@ module.exports = {
14
14
  ecs: false,
15
15
  cognito: false,
16
16
  apigateway: false,
17
+ sts: true,
17
18
  },
18
19
 
19
20
  // Portas padrão
@@ -27,6 +28,8 @@ module.exports = {
27
28
  ecs: 8080,
28
29
  cognito: 9229,
29
30
  apigateway: 4567,
31
+ sts: 9326,
32
+ athena: 4599,
30
33
  },
31
34
  apigateway: {
32
35
  defaultCors: {
package/src/index.js CHANGED
@@ -11,8 +11,16 @@ const DynamoDBService = require('./services/dynamodb');
11
11
  const S3Service = require('./services/s3');
12
12
  const SQSService = require('./services/sqs');
13
13
  const LambdaService = require('./services/lambda');
14
- const SNSService = require('./services/sns');
15
- const EventBridgeService = require('./services/eventbridge');
14
+ const { SNSService } = require('./services/sns');
15
+ const { EventBridgeService } = require('./services/eventbridge');
16
+ const { CloudWatchService } = require('./services/cloudwatch');
17
+ const CloudTrailService = require('./services/cloudtrail');
18
+ const { KMSService } = require('./services/kms');
19
+ const CloudFormationService = require('./services/cloudformation');
20
+ const { XRayService } = require('./services/xray');
21
+ const { SecretManagerService } = require('./services/secret-manager');
22
+ const { ParameterStoreService } = require('./services/parameter-store');
23
+ const { ConfigService } = require('./services/config');
16
24
 
17
25
  // Exporta utilitários
18
26
  const LocalStore = require('./utils/local-store');
@@ -122,6 +130,14 @@ module.exports = {
122
130
  LambdaService,
123
131
  SNSService,
124
132
  EventBridgeService,
133
+ CloudWatchService,
134
+ CloudTrailService,
135
+ KMSService,
136
+ CloudFormationService,
137
+ XRayService,
138
+ SecretManagerService,
139
+ ParameterStoreService,
140
+ ConfigService,
125
141
  LocalStore,
126
142
  HandlerLoader,
127
143
  RouteRegistry