@gugananuvem/aws-local-simulator 1.0.34 → 1.0.39

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 (150) hide show
  1. package/README.md +662 -658
  2. package/package.json +11 -4
  3. package/src/config/default-config.js +71 -0
  4. package/src/config/env-loader.js +4 -2
  5. package/src/middleware/authorization.js +271 -0
  6. package/src/middleware/cloudtrail-logger.js +333 -0
  7. package/src/middleware/error-handler.js +138 -0
  8. package/src/middleware/index.js +79 -0
  9. package/src/middleware/policy-enforcement.js +407 -0
  10. package/src/server.js +74 -4
  11. package/src/services/acm/index.js +66 -0
  12. package/src/services/acm/models/certificate.js +202 -0
  13. package/src/services/acm/server.js +224 -0
  14. package/src/services/acm/simulator.js +293 -0
  15. package/src/services/alb/index.js +104 -0
  16. package/src/services/alb/models/loadBalancer.js +88 -0
  17. package/src/services/alb/models/targetGroup.js +128 -0
  18. package/src/services/alb/server.js +160 -0
  19. package/src/services/alb/simulator.js +262 -0
  20. package/src/services/apigateway/index.js +22 -0
  21. package/src/services/apigateway/server.js +247 -35
  22. package/src/services/apigateway/simulator.js +780 -26
  23. package/src/services/asg/index.js +100 -0
  24. package/src/services/asg/models/autoScalingGroup.js +110 -0
  25. package/src/services/asg/models/launchTemplate.js +41 -0
  26. package/src/services/asg/models/scalingPolicy.js +51 -0
  27. package/src/services/asg/server.js +236 -0
  28. package/src/services/asg/simulator.js +410 -0
  29. package/src/services/aurora/cluster-manager.js +731 -0
  30. package/src/services/aurora/data-api.js +514 -0
  31. package/src/services/aurora/db-engine.js +270 -0
  32. package/src/services/aurora/index.js +159 -0
  33. package/src/services/aurora/rds-api.js +189 -0
  34. package/src/services/aurora/server.js +213 -0
  35. package/src/services/aurora/sql-translator.js +334 -0
  36. package/src/services/cloudformation/index.js +2 -2
  37. package/src/services/cloudformation/server.js +1 -0
  38. package/src/services/cloudfront/cache-engine.js +225 -0
  39. package/src/services/cloudfront/geo-restrictions.js +377 -0
  40. package/src/services/cloudfront/index.js +220 -0
  41. package/src/services/cloudfront/models/behavior.js +158 -0
  42. package/src/services/cloudfront/models/distribution.js +284 -0
  43. package/src/services/cloudfront/models/index.js +99 -0
  44. package/src/services/cloudfront/models/invalidation.js +109 -0
  45. package/src/services/cloudfront/models/origin.js +155 -0
  46. package/src/services/cloudfront/origin-router.js +552 -0
  47. package/src/services/cloudfront/origin-validator.js +398 -0
  48. package/src/services/cloudfront/server.js +512 -0
  49. package/src/services/cloudfront/signed-url-generator.js +377 -0
  50. package/src/services/cloudfront/simulator.js +425 -0
  51. package/src/services/cloudfront/store.js +326 -0
  52. package/src/services/cloudshell/env-builder.js +27 -0
  53. package/src/services/cloudshell/index.js +48 -0
  54. package/src/services/cloudshell/routes.js +60 -0
  55. package/src/services/cloudshell/session-manager.js +226 -0
  56. package/src/services/cloudshell/static/.gitkeep +0 -0
  57. package/src/services/cloudshell/static/index.html +406 -0
  58. package/src/services/cloudshell/websocket-handler.js +107 -0
  59. package/src/services/cloudtrail/index.js +2 -3
  60. package/src/services/cloudtrail/server.js +68 -0
  61. package/src/services/cognito/server.js +4 -1
  62. package/src/services/dynamodb/server.js +4 -1
  63. package/src/services/dynamodb/simulator.js +2 -1
  64. package/src/services/ec2/index.js +101 -0
  65. package/src/services/ec2/instanceServer.js +311 -0
  66. package/src/services/ec2/models/ami.js +39 -0
  67. package/src/services/ec2/models/instance.js +98 -0
  68. package/src/services/ec2/models/networkInterface.js +74 -0
  69. package/src/services/ec2/models/securityGroup.js +71 -0
  70. package/src/services/ec2/server.js +350 -0
  71. package/src/services/ec2/simulator.js +436 -0
  72. package/src/services/eventbridge/server.js +36 -0
  73. package/src/services/eventbridge/simulator.js +230 -45
  74. package/src/services/iam/index.js +65 -0
  75. package/src/services/iam/middleware.js +99 -0
  76. package/src/services/iam/server.js +331 -0
  77. package/src/services/iam/simulator.js +1432 -0
  78. package/src/services/index.js +28 -0
  79. package/src/services/kinesis-analytics/index.js +105 -0
  80. package/src/services/kinesis-analytics/models/application.js +325 -0
  81. package/src/services/kinesis-analytics/models/index.js +12 -0
  82. package/src/services/kinesis-analytics/server.js +250 -0
  83. package/src/services/kinesis-analytics/simulator.js +407 -0
  84. package/src/services/kinesis-analytics/store.js +176 -0
  85. package/src/services/kinesis-data-streams/index.js +106 -0
  86. package/src/services/kinesis-data-streams/models/index.js +12 -0
  87. package/src/services/kinesis-data-streams/models/record.js +70 -0
  88. package/src/services/kinesis-data-streams/models/stream.js +280 -0
  89. package/src/services/kinesis-data-streams/server.js +255 -0
  90. package/src/services/kinesis-data-streams/simulator.js +514 -0
  91. package/src/services/kinesis-data-streams/store.js +163 -0
  92. package/src/services/kinesis-firehose/index.js +106 -0
  93. package/src/services/kinesis-firehose/models/delivery-stream.js +265 -0
  94. package/src/services/kinesis-firehose/models/index.js +10 -0
  95. package/src/services/kinesis-firehose/server.js +215 -0
  96. package/src/services/kinesis-firehose/simulator.js +388 -0
  97. package/src/services/kinesis-firehose/store.js +163 -0
  98. package/src/services/kms/server.js +4 -1
  99. package/src/services/lambda/handler-loader.js +50 -5
  100. package/src/services/lambda/index.js +26 -0
  101. package/src/services/lambda/server.js +18 -12
  102. package/src/services/lambda/simulator.js +73 -17
  103. package/src/services/opensearch/index.js +105 -0
  104. package/src/services/opensearch/models/document.js +115 -0
  105. package/src/services/opensearch/models/index.js +73 -0
  106. package/src/services/opensearch/server.js +310 -0
  107. package/src/services/opensearch/simulator.js +605 -0
  108. package/src/services/opensearch/store.js +162 -0
  109. package/src/services/organizations/control-tower-simulator.js +321 -0
  110. package/src/services/organizations/control-tower-store.js +182 -0
  111. package/src/services/organizations/iam-integration.js +413 -0
  112. package/src/services/organizations/index.js +172 -0
  113. package/src/services/organizations/models/index.js +13 -0
  114. package/src/services/organizations/models/invitation.js +48 -0
  115. package/src/services/organizations/models/organization.js +566 -0
  116. package/src/services/organizations/models/role.js +244 -0
  117. package/src/services/organizations/models/scp.js +131 -0
  118. package/src/services/organizations/server.js +736 -0
  119. package/src/services/organizations/simulator.js +593 -0
  120. package/src/services/organizations/store.js +235 -0
  121. package/src/services/organizations/vpc-integration.js +453 -0
  122. package/src/services/route53/index.js +67 -0
  123. package/src/services/route53/models/healthCheck.js +101 -0
  124. package/src/services/route53/models/hostedZone.js +37 -0
  125. package/src/services/route53/models/resourceRecord.js +106 -0
  126. package/src/services/route53/server.js +841 -0
  127. package/src/services/route53/simulator.js +350 -0
  128. package/src/services/s3/index.js +62 -0
  129. package/src/services/s3/presigned-url-generator.js +337 -0
  130. package/src/services/s3/server.js +231 -0
  131. package/src/services/s3/simulator.js +551 -4
  132. package/src/services/sns/index.js +31 -0
  133. package/src/services/sns/server.js +9 -0
  134. package/src/services/sqs/index.js +38 -0
  135. package/src/services/sqs/server.js +57 -4
  136. package/src/services/sqs/simulator.js +423 -33
  137. package/src/services/sts/simulator.js +209 -17
  138. package/src/services/vpc/README.md +459 -0
  139. package/src/services/vpc/ec2ResponseFormatter.js +431 -0
  140. package/src/services/vpc/index.js +90 -0
  141. package/src/services/vpc/models/internetGateway.js +71 -0
  142. package/src/services/vpc/models/routeTable.js +160 -0
  143. package/src/services/vpc/models/subnet.js +48 -0
  144. package/src/services/vpc/models/vpc.js +37 -0
  145. package/src/services/vpc/models/vpcEndpoint.js +100 -0
  146. package/src/services/vpc/models/vpcGateway.js +134 -0
  147. package/src/services/vpc/server.js +836 -0
  148. package/src/services/vpc/simulator.js +613 -0
  149. package/src/utils/policy-cache.js +215 -0
  150. package/aws-config +0 -154
package/README.md CHANGED
@@ -6,69 +6,94 @@
6
6
 
7
7
  Simulador local completo para serviços AWS. Desenvolva e teste suas aplicações AWS localmente sem custos!
8
8
 
9
- ## 🚀 Serviços Suportados
10
-
11
- | Serviço | Status | Porta Padrão | Descrição |
12
- |---------|--------|--------------|-----------|
13
- | DynamoDB | ✅ | 8000 | Banco de dados NoSQL |
14
- | S3 | ✅ | 4566 | Armazenamento de objetos |
15
- | SQS | ✅ | 9324 | Filas de mensagens |
16
- | Lambda | ✅ | 3001 | Funções serverless |
17
- | Cognito | ✅ | 9229 | Autenticação e autorização |
18
- | API Gateway | ✅ | 4567 | APIs REST e HTTP |
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) |
32
-
33
- ## 📦 Instalação
34
-
35
- ```bash
36
- npm install --save-dev @gugananuvem/aws-local-simulator
37
- ```
38
-
39
- ## 🚀 Uso Rápido
40
-
41
- ### 1. Crie um arquivo de configuração `aws-local-simulator.json`:
9
+ ## 🚀 Começar Rápido
10
+
11
+ 1. **Instalação**: `npm install --save-dev @gugananuvem/aws-local-simulator`
12
+ 2. **Iniciar**: `npx aws-local-simulator start`
13
+ 3. **Configurar**: Crie `aws-local-simulator.json`
14
+ 4. **Conectar**: Use SDK AWS apontando para localhost
15
+
16
+ 📚 **[Guia de Instalação Completo](docs/setup/installation.md)**
17
+
18
+ ## 🔌 27+ Serviços Suportados
19
+
20
+ ### Armazenamento & Dados
21
+ | Serviço | Porta | Link |
22
+ |---------|-------|------|
23
+ | **S3** | 4566 | [Documentação](docs/services/S3.md) |
24
+ | **DynamoDB** | 8000 | [Documentação](docs/services/DynamoDB.md) |
25
+ | **OpenSearch** | 9200 | [Documentação](docs/services/OpenSearch.md) |
26
+ | **Athena** | 4599 | [Documentação](docs/services/Athena.md) |
27
+
28
+ ### Computação
29
+ | Serviço | Porta | Link |
30
+ |---------|-------|------|
31
+ | **Lambda** | 3001 | [Documentação](docs/services/Lambda.md) |
32
+ | **EC2** | 4020 | [Documentação](docs/services/EC2.md) |
33
+ | **ALB** | 4021 | [Documentação](docs/services/EC2.md) |
34
+ | **ASG** | 4022 | [Documentação](docs/services/EC2.md) |
35
+
36
+ ### Mensageria & Eventos
37
+ | Serviço | Porta | Link |
38
+ |---------|-------|------|
39
+ | **SQS** | 9324 | [Documentação](docs/services/SQS.md) |
40
+ | **SNS** | 9911 | [Documentação](docs/services/SNS.md) |
41
+ | **Kinesis** | 4568+ | [Documentação](docs/services/Kinesis.md) |
42
+ | **EventBridge** | 4010 | [Documentação](docs/services/EventBridge.md) |
43
+
44
+ ### Rede & Segurança
45
+ | Serviço | Porta | Link |
46
+ |---------|-------|------|
47
+ | **VPC** | 4014 | [Documentação](docs/services/VPC.md) |
48
+ | **Route53** ⭐ | 4024 | [Documentação](docs/services/Route53.md) |
49
+ | **ACM** ⭐ | 4025 | [Documentação](docs/services/ACM.md) |
50
+ | **IAM** | 4003 | [Documentação](docs/services/IAM.md) |
51
+ | **Cognito** | 9229 | [Documentação](docs/services/Cognito.md) |
52
+
53
+ ### Infraestrutura & Observabilidade
54
+ | Serviço | Porta | Link |
55
+ |---------|-------|------|
56
+ | **CloudFormation** | 4582 | [Documentação](docs/services/CloudFormation.md) |
57
+ | **Organizations** | 4581 | [Documentação](docs/services/Organizations.md) |
58
+ | **Control Tower** | 4581 | [Documentação](docs/services/Organizations.md) |
59
+ | **CloudWatch** | 4011 | [Documentação](docs/services/CloudWatch.md) |
60
+ | **AWS Config** | 4013 | [Documentação](docs/services/Config.md) |
61
+ | **API Gateway** | 4567 | [Documentação](docs/services/API_Gateway.md) |
62
+
63
+ **[Ver lista completa de portas →](docs/setup/ports.md)**
64
+
65
+ ## 📚 Documentação por Serviço
66
+
67
+ Cada serviço tem documentação própria com:
68
+ - 📖 Visão geral e features
69
+ - 🚀 Quick Start com exemplos
70
+ - 📝 Exemplos completos de uso
71
+ - 🧪 Guia de testes
72
+
73
+ **Acesse**: `docs/services/<SERVIÇO>.md`
74
+
75
+ Exemplo: [docs/services/VPC.md](docs/services/VPC.md), [docs/services/Lambda.md](docs/services/Lambda.md)
76
+
77
+ ## 🔧 Configuração
78
+
79
+ ### Arquivo de Configuração
42
80
 
43
81
  ```json
44
82
  {
45
83
  "services": {
46
- "dynamodb": true,
47
84
  "s3": true,
48
- "sqs": true,
85
+ "dynamodb": true,
49
86
  "lambda": true,
50
- "cognito": 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
87
+ "vpc": true,
88
+ "ec2": true,
89
+ "sqs": true,
90
+ "cognito": true
64
91
  },
65
92
  "lambdas": [
66
93
  {
67
94
  "name": "my-function",
68
- "handler": "./src/handlers/users.js",
69
- "env": {
70
- "TABLE_NAME": "users-table"
71
- }
95
+ "handler": "./src/handlers/index.js",
96
+ "env": { "TABLE_NAME": "users-table" }
72
97
  }
73
98
  ],
74
99
  "dynamodb": {
@@ -80,92 +105,26 @@ npm install --save-dev @gugananuvem/aws-local-simulator
80
105
  }
81
106
  ]
82
107
  },
83
- "s3": {
84
- "buckets": [
85
- { "name": "my-bucket", "region": "us-east-1" }
86
- ]
87
- },
88
- "sqs": {
89
- "queues": ["my-queue", "dead-letter-queue"]
90
- },
91
- "cognito": {
92
- "userPools": [
93
- {
94
- "PoolName": "my-user-pool",
95
- "AutoVerifiedAttributes": ["email"]
96
- }
97
- ]
108
+ "ports": {
109
+ "s3": 4566,
110
+ "lambda": 3001,
111
+ "vpc": 4014
98
112
  }
99
113
  }
100
114
  ```
101
115
 
102
- ### 2. Inicie o simulador:
103
-
104
- ```bash
105
- # Via CLI
106
- npx aws-local-simulator start
107
-
108
- # Ou via código
109
- const { AWSLocalSimulator } = require('aws-local-simulator');
110
- const simulator = new AWSLocalSimulator();
111
- await simulator.start();
112
- ```
113
-
114
- ### 3. Configure seu código para usar os serviços locais:
115
-
116
- ```javascript
117
- const { dynamoDB, s3, sqs, cognito } = require('aws-local-simulator/aws-config');
118
-
119
- await dynamoDB.send(new PutCommand({
120
- TableName: 'users-table',
121
- Item: { id: '123', name: 'John' }
122
- }));
123
- ```
124
-
125
- ## 🔧 Configuração por Variáveis de Ambiente
126
-
127
- | Variável | Descrição | Padrão |
128
- |---------|----------|-------|
129
- | AWS_LOCAL_SIMULATOR_DYNAMODB | Habilita DynamoDB | true |
130
- | AWS_LOCAL_SIMULATOR_S3 | Habilita S3 | true |
131
- | AWS_LOCAL_SIMULATOR_SQS | Habilita SQS | true |
132
- | AWS_LOCAL_SIMULATOR_LAMBDA | Habilita Lambda | true |
133
- | AWS_LOCAL_SIMULATOR_COGNITO | Habilita Cognito | false |
134
- | AWS_LOCAL_SIMULATOR_APIGATEWAY | Habilita API Gateway | false |
135
- | AWS_LOCAL_SIMULATOR_STS | Habilita STS | true |
136
- | AWS_LOCAL_SIMULATOR_SNS | Habilita SNS | false |
137
- | AWS_LOCAL_SIMULATOR_EVENTBRIDGE | Habilita EventBridge | false |
138
- | AWS_LOCAL_SIMULATOR_KMS | Habilita KMS | false |
139
- | AWS_LOCAL_SIMULATOR_SECRET_MANAGER | Habilita Secrets Manager | false |
140
- | AWS_LOCAL_SIMULATOR_PARAMETER_STORE | Habilita Parameter Store | false |
141
- | AWS_LOCAL_SIMULATOR_CLOUDWATCH | Habilita CloudWatch | false |
142
- | AWS_LOCAL_SIMULATOR_CLOUDTRAIL | Habilita CloudTrail | false |
143
- | AWS_LOCAL_SIMULATOR_CLOUDFORMATION | Habilita CloudFormation | false |
144
- | AWS_LOCAL_SIMULATOR_ATHENA | Habilita Athena | false |
145
- | AWS_LOCAL_SIMULATOR_XRAY | Habilita X-Ray | false |
146
- | AWS_LOCAL_SIMULATOR_CONFIG | Habilita AWS Config | false |
147
- | AWS_LOCAL_SIMULATOR_ECS | Habilita ECS/Fargate | false |
148
- | AWS_LOCAL_SIMULATOR_DYNAMODB_PORT | Porta DynamoDB | 8000 |
149
- | AWS_LOCAL_SIMULATOR_S3_PORT | Porta S3 | 4566 |
150
- | AWS_LOCAL_SIMULATOR_SQS_PORT | Porta SQS | 9324 |
151
- | AWS_LOCAL_SIMULATOR_LAMBDA_PORT | Porta Lambda | 3001 |
152
- | AWS_LOCAL_SIMULATOR_COGNITO_PORT | Porta Cognito | 9229 |
153
- | AWS_LOCAL_SIMULATOR_APIGATEWAY_PORT | Porta API Gateway | 4567 |
154
- | AWS_LOCAL_SIMULATOR_STS_PORT | Porta STS | 9326 |
155
- | AWS_LOCAL_SIMULATOR_SNS_PORT | Porta SNS | 9911 |
156
- | AWS_LOCAL_SIMULATOR_EVENTBRIDGE_PORT | Porta EventBridge | 4010 |
157
- | AWS_LOCAL_SIMULATOR_KMS_PORT | Porta KMS | 4000 |
158
- | AWS_LOCAL_SIMULATOR_SECRET_MANAGER_PORT | Porta Secrets Manager | 4001 |
159
- | AWS_LOCAL_SIMULATOR_PARAMETER_STORE_PORT | Porta Parameter Store | 4002 |
160
- | AWS_LOCAL_SIMULATOR_CLOUDWATCH_PORT | Porta CloudWatch | 4011 |
161
- | AWS_LOCAL_SIMULATOR_CLOUDTRAIL_PORT | Porta CloudTrail | 4012 |
162
- | AWS_LOCAL_SIMULATOR_CONFIG_PORT | Porta AWS Config | 4013 |
163
- | AWS_LOCAL_SIMULATOR_XRAY_PORT | Porta X-Ray | 4015 |
164
- | AWS_LOCAL_SIMULATOR_CLOUDFORMATION_PORT | Porta CloudFormation | 4580 |
165
- | AWS_LOCAL_SIMULATOR_ATHENA_PORT | Porta Athena | 4599 |
166
- | AWS_LOCAL_SIMULATOR_ECS_PORT | Porta ECS | 8080 |
167
- | AWS_LOCAL_SIMULATOR_DATA | Diretório de dados | ./aws-local-simulator-data |
168
- | AWS_LOCAL_SIMULATOR_LOG | Nível de log | info |
116
+ ### Variáveis de Ambiente
117
+
118
+ ```bash
119
+ AWS_LOCAL_SIMULATOR_S3=true
120
+ AWS_LOCAL_SIMULATOR_S3_PORT=4566
121
+ AWS_LOCAL_SIMULATOR_DYNAMODB=true
122
+ AWS_LOCAL_SIMULATOR_DYNAMODB_PORT=8000
123
+ AWS_LOCAL_SIMULATOR_LAMBDA=true
124
+ AWS_LOCAL_SIMULATOR_LAMBDA_PORT=3001
125
+ ```
126
+
127
+ [Todas as variáveis de ambiente →](docs/setup/environment.md)
169
128
 
170
129
  ## 📝 Comandos CLI
171
130
 
@@ -173,7 +132,7 @@ await dynamoDB.send(new PutCommand({
173
132
  # Iniciar simulador
174
133
  npx aws-local-simulator start [configPath]
175
134
 
176
- # Parar simulador
135
+ # Parar
177
136
  npx aws-local-simulator stop
178
137
 
179
138
  # Reiniciar
@@ -188,647 +147,692 @@ npx aws-local-simulator status
188
147
 
189
148
  ## 🖥️ Management API
190
149
 
191
- O simulador expõe uma API de gerenciamento em tempo de execução na porta `9999` (configurável via `adminPort`). Ela permite habilitar e desabilitar serviços individualmente sem reiniciar o processo.
192
-
193
- ### Endpoints da Management API
194
-
195
- | Método | Rota | Descrição |
196
- |--------|------|-----------|
197
- | GET | `/__admin/services` | Lista todos os 19 serviços com status |
198
- | GET | `/__admin/services/:name` | Status de um serviço específico |
199
- | POST | `/__admin/services/:name/enable` | Habilita um serviço parado |
200
- | POST | `/__admin/services/:name/disable` | Desabilita um serviço em execução |
201
-
202
- ### Exemplos
150
+ O simulador expõe Management API na porta `9999` para controlar serviços em tempo de execução:
203
151
 
204
152
  ```bash
205
- # Listar todos os serviços
153
+ # Listar serviços
206
154
  curl http://localhost:9999/__admin/services
207
155
 
208
- # Habilitar DynamoDB
156
+ # Habilitar/desabilitar
209
157
  curl -X POST http://localhost:9999/__admin/services/dynamodb/enable
210
-
211
- # Desabilitar SQS
212
158
  curl -X POST http://localhost:9999/__admin/services/sqs/disable
213
-
214
- # Status de um serviço
215
- curl http://localhost:9999/__admin/services/lambda
216
159
  ```
217
160
 
218
- ### Configuração da porta admin
161
+ [Documentação da Management API →](docs/guides/management-api.md)
219
162
 
220
- ```json
221
- {
222
- "adminPort": 9999
223
- }
163
+ ## 📚 Guias Temáticos
164
+
165
+ - **[Integração Multi-Serviço](docs/guides/integration.md)** - Usar múltiplos serviços juntos
166
+ - **[Testes e Verificação](docs/guides/testing.md)** - Testar aplicações localmente
167
+ - **[Segurança e IAM](docs/guides/security.md)** - Policy enforcement e controle de acesso
168
+ - **[Troubleshooting](docs/guides/troubleshooting.md)** - Resolver problemas comuns
169
+ - **[Proxy Setup](docs/setup/proxy.md)** - Configurar proxy entre serviços
170
+
171
+ ## 🔌 Configuração de Portas
172
+
173
+ Cada serviço usa uma porta padrão diferente:
174
+
175
+ | Serviço | Porta Padrão |
176
+ |---------|-------------|
177
+ | S3 | 4566 |
178
+ | DynamoDB | 8000 |
179
+ | Lambda | 3001 |
180
+ | VPC/EC2 | 4014/4020 |
181
+ | API Gateway | 4567 |
182
+ | Kinesis | 4568-4570 |
183
+ | Athena | 4599 |
184
+ | CloudFormation | 4582 |
185
+ | Organizations/Control Tower | 4581 |
186
+ | AWS Config | 4013 |
187
+
188
+ [Configuração completa de portas →](docs/setup/ports.md)
189
+
190
+ ## 💡 Exemplos Rápidos
191
+
192
+ ### S3
193
+ ```bash
194
+ aws s3 ls --endpoint-url http://localhost:4566
195
+ aws s3 mb s3://my-bucket --endpoint-url http://localhost:4566
224
196
  ```
225
197
 
226
- Ou via variável de ambiente:
198
+ ### DynamoDB
227
199
  ```bash
228
- AWS_LOCAL_SIMULATOR_ADMIN_PORT=9999 npx aws-local-simulator start
200
+ aws dynamodb list-tables --endpoint-url http://localhost:8000
201
+ aws dynamodb scan --table-name users --endpoint-url http://localhost:8000
229
202
  ```
230
203
 
231
- > A Management API nunca persiste alterações em disco — todo o estado é mantido em memória. Para uso em desenvolvimento local apenas.
204
+ ### Lambda
205
+ ```bash
206
+ aws lambda list-functions --endpoint-url http://localhost:3001
207
+ aws lambda invoke --function-name my-func output.json --endpoint-url http://localhost:3001
208
+ ```
232
209
 
233
- ## 🔌 Endpoints
210
+ ### VPC
234
211
 
235
- | Serviço | Endpoint | Admin |
236
- |---------|----------|-------|
237
- | DynamoDB | http://localhost:8000 | http://localhost:8000/__admin/tables |
238
- | S3 | http://localhost:4566 | http://localhost:4566/__admin/buckets |
239
- | S3 Website | http://localhost:4566/website/{bucket}/ | — |
240
- | SQS | http://localhost:9324 | http://localhost:9324/__admin/queues |
241
- | Lambda | http://localhost:3001 | http://localhost:3001/__admin/functions |
242
- | Cognito | http://localhost:9229 | http://localhost:9229/__admin/userpools |
243
- | API Gateway | http://localhost:4567 | http://localhost:4567/__admin/apis |
244
- | STS | http://localhost:9326 | — |
245
- | SNS | http://localhost:9911 | http://localhost:9911/__admin/health |
246
- | EventBridge | http://localhost:4010 | — |
247
- | KMS | http://localhost:4000 | — |
248
- | Secrets Manager | http://localhost:4001 | — |
249
- | Parameter Store | http://localhost:4002 | — |
250
- | CloudWatch | http://localhost:4011 | — |
251
- | CloudTrail | http://localhost:4012 | — |
252
- | AWS Config | http://localhost:4013 | — |
253
- | X-Ray | http://localhost:4015 | — |
254
- | CloudFormation | http://localhost:4580 | http://localhost:4580/__admin/stacks |
255
- | Athena | http://localhost:4599 | http://localhost:4599/__admin/health |
256
- | ECS | http://localhost:8080 | http://localhost:8080/__admin/clusters |
257
- | Management API | http://localhost:9999 | http://localhost:9999/__admin/services |
212
+ **Usando AWS CLI (recomendado):**
213
+ ```bash
214
+ aws ec2 describe-vpcs --endpoint-url http://localhost:4014
215
+ aws ec2 create-vpc --cidr-block 10.0.0.0/16 --endpoint-url http://localhost:4014
216
+ ```
258
217
 
259
- ## 🧪 Testando com AWS CLI
218
+ **Criar VPC Endpoint DynamoDB (AWS CLI):**
219
+ ```bash
220
+ aws ec2 create-vpc-endpoint \
221
+ --vpc-id vpc-xxxxx \
222
+ --service-name com.amazonaws.us-east-1.dynamodb \
223
+ --vpc-endpoint-type Gateway \
224
+ --route-table-ids rtb-xxxxx \
225
+ --endpoint-url http://localhost:4014
226
+ ```
260
227
 
228
+ **Criar VPC Endpoint S3 (AWS CLI):**
261
229
  ```bash
262
- # DynamoDB
263
- aws dynamodb list-tables --endpoint-url http://localhost:8000
230
+ aws ec2 create-vpc-endpoint \
231
+ --vpc-id vpc-xxxxx \
232
+ --service-name com.amazonaws.us-east-1.s3 \
233
+ --vpc-endpoint-type Gateway \
234
+ --route-table-ids rtb-xxxxx \
235
+ --endpoint-url http://localhost:4014
236
+ ```
264
237
 
265
- # S3
266
- aws s3 ls --endpoint-url http://localhost:4566
238
+ **Criar VPC Endpoint SQS (AWS CLI):**
239
+ ```bash
240
+ aws ec2 create-vpc-endpoint \
241
+ --vpc-id vpc-xxxxx \
242
+ --service-name com.amazonaws.us-east-1.sqs \
243
+ --vpc-endpoint-type Interface \
244
+ --subnet-ids subnet-xxxxx \
245
+ --endpoint-url http://localhost:4014
246
+ ```
247
+
248
+ **Criar VPC Endpoint SNS (AWS CLI):**
249
+ ```bash
250
+ aws ec2 create-vpc-endpoint \
251
+ --vpc-id vpc-xxxxx \
252
+ --service-name com.amazonaws.us-east-1.sns \
253
+ --vpc-endpoint-type Interface \
254
+ --subnet-ids subnet-xxxxx \
255
+ --endpoint-url http://localhost:4014
256
+ ```
267
257
 
268
- # SQS
269
- aws sqs list-queues --endpoint-url http://localhost:9324
270
-
271
- # Lambda
272
- aws lambda invoke \
273
- --function-name my-function \
274
- --payload '{"key":"value"}' \
275
- --endpoint-url http://localhost:3001 \
276
- output.json
277
-
278
- # Cognito
279
- aws cognito-idp list-user-pools --max-results 10 --endpoint-url http://localhost:9229
280
-
281
- # Cognito cadastrar um usuario pelo adminstrador
282
- aws cognito-idp admin-create-user \
283
- --user-pool-id us-east-xxxx\
284
- --username usuario@email.com \
285
- --user-attributes \
286
- Name=email,Value=usuario@email.com \
287
- Name=email_verified,Value=false \
288
- Name=name,Value="nome usuario" \
289
- Name=custom:role,Value="user" \
290
- temporary-password "Teste@123456" \
291
- --message-action SUPPRESS \
292
- --endpoint-url http://localhost:9229
293
-
294
- # Cognito excluir um usuario
295
- aws cognito-idp admin-delete-user \
296
- --user-pool-id us-east-xxxx \
297
- --username usuario@email.com
298
- --endpoint-url http://localhost:9229
299
-
300
- # Cognito Registrar usuário
301
- aws cognito-idp sign-up \
302
- --client-id $CLIENT_ID \
303
- --username usuario@email.com \
304
- --password "Teste@123456" \
305
- --user-attributes Name=email,Value=usuario@email.com Name=name,Value="nome usuario"
306
- --endpoint-url http://localhost:9229
307
-
308
- # 2. Confirmar usuário administrativamente
309
- aws cognito-idp admin-confirm-sign-up \
310
- --user-pool-id us-east-xxxx \
311
- --username usuario@email.com
312
- --endpoint-url http://localhost:9229
313
-
314
- # O código chega no e-mail do usuário. Algo como: "Your confirmation code is 123456"
315
- aws cognito-idp confirm-sign-up \
316
- --client-id 3n4b5urk1ft4fl3mg5e62d9ado \
317
- --username usuario@email.com \
318
- --confirmation-code 123456
319
- --endpoint-url http://localhost:9229
320
-
321
- # STS
322
- aws sts get-caller-identity --endpoint-url http://localhost:9326
323
- aws sts assume-role \
324
- --role-arn "arn:aws:iam::123456789012:role/my-role" \
325
- --role-session-name "my-session" \
326
- --endpoint-url http://localhost:9326
327
-
328
- # SNS
329
- aws sns list-topics --endpoint-url http://localhost:9911
330
-
331
- # EventBridge
332
- aws events list-event-buses --endpoint-url http://localhost:4010
333
-
334
- # KMS
335
- aws kms list-keys --endpoint-url http://localhost:4000
336
-
337
- # Secrets Manager
338
- aws secretsmanager list-secrets --endpoint-url http://localhost:4001
339
-
340
- # Criar secret
341
- aws secretsmanager create-secret \
342
- --name "local/app/db-credentials" \
343
- --description "Credenciais do banco" \
344
- --secret-string '{"username":"admin","password":"secret123"}' \
345
- --endpoint-url http://localhost:4001
346
-
347
- # Ler secret
348
- aws secretsmanager get-secret-value \
349
- --secret-id "local/app/db-credentials" \
350
- --endpoint-url http://localhost:4001
351
-
352
- # Parameter Store
353
- aws ssm describe-parameters --endpoint-url http://localhost:4002
354
-
355
- # Criar parâmetro String
356
- aws ssm put-parameter \
357
- --name "/local/app/config" \
358
- --value '{"timeout":30,"maxRetries":3}' \
359
- --type String \
360
- --endpoint-url http://localhost:4002
361
-
362
- # Criar parâmetro SecureString
363
- aws ssm put-parameter \
364
- --name "/local/app/api-key" \
365
- --value "my-secret-api-key" \
366
- --type SecureString \
367
- --endpoint-url http://localhost:4002
368
-
369
- # Ler parâmetro
370
- aws ssm get-parameter \
371
- --name "/local/app/config" \
372
- --endpoint-url http://localhost:4002
373
-
374
- # CloudWatch
375
- aws cloudwatch list-metrics --endpoint-url http://localhost:4011
376
- aws logs describe-log-groups --endpoint-url http://localhost:4011
377
-
378
- # CloudTrail
379
- aws cloudtrail describe-trails --endpoint-url http://localhost:4012
380
-
381
- # CloudFormation
382
- aws cloudformation list-stacks --endpoint-url http://localhost:4580
383
-
384
- # X-Ray
385
- aws xray get-trace-summaries \
386
- --start-time $(date -d '1 hour ago' +%s) \
387
- --end-time $(date +%s) \
388
- --endpoint-url http://localhost:4015
389
-
390
- # AWS Config
391
- aws configservice describe-configuration-recorders --endpoint-url http://localhost:4013
392
-
393
- # API Gateway
394
- aws apigateway get-rest-apis --endpoint-url http://localhost:4567
395
-
396
- # Cloudformation
397
- aws cloudformation create-stack \
398
- --stack-name test-stack \
399
- --template-body file://templates/test-stack.yaml \
400
- --parameters \
401
- ParameterKey=Environment,ParameterValue=local \
402
- ParameterKey=BucketName,ParameterValue=meu-bucket \
403
- ParameterKey=QueueName,ParameterValue=minha-fila \
404
- ParameterKey=TableName,ParameterValue=minha-tabela \
405
- --endpoint-url http://localhost:4580
406
-
407
- # Ver Cloudformation resultado
408
- aws cloudformation describe-stacks \
409
- --stack-name test-stack \
410
- --endpoint-url http://localhost:4580
411
-
412
- # Athena
258
+ ### Athena
259
+ ```bash
413
260
  # Criar workgroup
414
261
  aws athena create-work-group \
415
262
  --name my-workgroup \
416
- --configuration ResultConfiguration={OutputLocation=s3://meu-bucket/athena-results/} \
263
+ --configuration ResultConfiguration={OutputLocation=s3://my-bucket/results/} \
417
264
  --endpoint-url http://localhost:4599
418
265
 
419
- # Listar workgroups
420
- aws athena list-work-groups --endpoint-url http://localhost:4599
421
-
422
266
  # Executar query
423
267
  aws athena start-query-execution \
424
268
  --query-string "SELECT * FROM my_table LIMIT 10" \
425
269
  --query-execution-context Database=default \
426
- --result-configuration OutputLocation=s3://meu-bucket/athena-results/ \
427
- --endpoint-url http://localhost:4599
428
-
429
- # Verificar status da query
430
- aws athena get-query-execution \
431
- --query-execution-id <id-retornado> \
270
+ --result-configuration OutputLocation=s3://my-bucket/results/ \
432
271
  --endpoint-url http://localhost:4599
272
+ ```
433
273
 
434
- # Buscar resultados
435
- aws athena get-query-results \
436
- --query-execution-id <id-retornado> \
437
- --endpoint-url http://localhost:4599
274
+ ### AWS Config
275
+ ```bash
276
+ # Listar configuration recorders
277
+ aws configservice describe-configuration-recorders \
278
+ --endpoint-url http://localhost:4013
438
279
 
439
- # Criar named query
440
- aws athena create-named-query \
441
- --name "my-saved-query" \
442
- --database default \
443
- --query-string "SELECT id, value FROM my_table WHERE status = 'active'" \
444
- --endpoint-url http://localhost:4599
280
+ # Descrever resources
281
+ aws configservice describe-config-resources \
282
+ --endpoint-url http://localhost:4013
445
283
 
446
- # Listar named queries
447
- aws athena list-named-queries --endpoint-url http://localhost:4599
284
+ # Descrever compliance
285
+ aws configservice describe-compliance-by-config-rule \
286
+ --endpoint-url http://localhost:4013
448
287
  ```
449
288
 
450
- ## ⚙️ Configuração S3
451
-
452
- ### Buckets simples
453
-
454
- ```json
455
- {
456
- "s3": {
457
- "buckets": [
458
- "my-bucket"
459
- ]
460
- }
461
- }
289
+ ### AWS Organizations
290
+ ```bash
291
+ # Listar roots
292
+ aws organizations list-roots \
293
+ --endpoint-url http://localhost:4581
294
+
295
+ # Listar accounts
296
+ aws organizations list-accounts \
297
+ --endpoint-url http://localhost:4581
298
+
299
+ # Criar account
300
+ aws organizations create-account \
301
+ --email "newaccount@example.com" \
302
+ --account-name "New Account" \
303
+ --endpoint-url http://localhost:4581
462
304
  ```
463
305
 
464
- ### Buckets com região e website estático
306
+ ### Control Tower
307
+ ```bash
308
+ # Listar guardrails habilitados
309
+ aws controltower list-enabled-guardrails \
310
+ --endpoint-url http://localhost:4581
465
311
 
466
- ```json
467
- {
468
- "s3": {
469
- "buckets": [
470
- { "name": "my-bucket", "region": "us-east-1" },
471
- {
472
- "name": "my-site-bucket",
473
- "region": "us-east-1",
474
- "websiteConfiguration": {
475
- "IndexDocument": { "Suffix": "index.html" },
476
- "ErrorDocument": { "Key": "error.html" }
477
- }
478
- }
479
- ]
480
- }
481
- }
312
+ # Listar registered OUs
313
+ aws controltower list-organizational-units \
314
+ --endpoint-url http://localhost:4581
482
315
  ```
483
316
 
484
- Quando `websiteConfiguration` está presente, o bucket serve arquivos estáticos.
317
+ ### Route53 ⭐ NEW
485
318
 
486
- ### URL do website estático
319
+ **Nota Importante:**
320
+ - O simulador processa AWS CLI através da API REST internamente
321
+ - Use `--endpoint-url http://localhost:4024` para todas as operações Route53
322
+ - **No Windows PowerShell:** Parâmetros JSON inline com single quotes não funcionam devido à interpretação diferente de quotes. Use file-based JSON como mostrado nos exemplos (arquivo separado com `file://`)
323
+ - **No Linux/macOS:** Ambos inline e file-based JSON funcionam normalmente
487
324
 
325
+ #### Criar Hosted Zone
326
+
327
+ Usando AWS CLI (recomendado):
328
+ ```bash
329
+ aws route53 create-hosted-zone \
330
+ --name example.com \
331
+ --caller-reference $(date +%s) \
332
+ --endpoint-url http://localhost:4024
488
333
  ```
489
- http://localhost:4566/website/{bucket-name}/
490
- http://localhost:4566/website/{bucket-name}/caminho/pagina.html
334
+
335
+ Alternativa: Direto pela API REST
336
+ ```bash
337
+ curl -X POST http://localhost:4024/2013-04-01/hostedzone \
338
+ -H "Content-Type: application/json" \
339
+ -d '{
340
+ "Name": "example.com.",
341
+ "CallerReference": "unique-ref-001",
342
+ "HostedZoneConfig": {
343
+ "Comment": "Main hosted zone",
344
+ "PrivateZone": false
345
+ }
346
+ }'
491
347
  ```
492
348
 
493
- Exemplos:
349
+ #### Listar Hosted Zones
350
+
351
+ Usando AWS CLI (recomendado):
352
+ ```bash
353
+ aws route53 list-hosted-zones \
354
+ --endpoint-url http://localhost:4024
494
355
  ```
495
- http://localhost:4566/website/my-site-bucket/ → serve index.html
496
- http://localhost:4566/website/my-site-bucket/about.html → serve about.html
497
- http://localhost:4566/website/my-site-bucket/app/ → serve app/index.html
356
+
357
+ Alternativa: Direto pela API REST
358
+ ```bash
359
+ curl http://localhost:4024/2013-04-01/hostedzone
498
360
  ```
499
361
 
500
- ### Gerenciar website config via AWS CLI
362
+ #### Obter Hosted Zone
363
+
364
+ Usando AWS CLI (recomendado):
365
+ ```bash
366
+ aws route53 get-hosted-zone \
367
+ --id zone-id \
368
+ --endpoint-url http://localhost:4024
369
+ ```
501
370
 
371
+ Alternativa: Direto pela API REST
502
372
  ```bash
503
- # Habilitar website em um bucket existente
504
- aws s3api put-bucket-website \
505
- --bucket my-site-bucket \
506
- --website-configuration '{"IndexDocument":{"Suffix":"index.html"},"ErrorDocument":{"Key":"error.html"}}' \
507
- --endpoint-url http://localhost:4566
373
+ curl http://localhost:4024/2013-04-01/hostedzone/zone-id
374
+ ```
508
375
 
509
- # Ver configuração de website
510
- aws s3api get-bucket-website \
511
- --bucket my-site-bucket \
512
- --endpoint-url http://localhost:4566
376
+ #### Criar Resource Record (A record)
513
377
 
514
- # Remover website
515
- aws s3api delete-bucket-website \
516
- --bucket my-site-bucket \
517
- --endpoint-url http://localhost:4566
378
+ Usando AWS CLI com file-based JSON (recomendado para Windows):
379
+ ```bash
380
+ # Linux/macOS - inline JSON
381
+ aws route53 change-resource-record-sets \
382
+ --hosted-zone-id zone-id \
383
+ --change-batch '{
384
+ "Changes": [{
385
+ "Action": "CREATE",
386
+ "ResourceRecordSet": {
387
+ "Name": "www.example.com",
388
+ "Type": "A",
389
+ "TTL": 300,
390
+ "ResourceRecords": [{"Value": "192.0.2.1"}]
391
+ }
392
+ }]
393
+ }' \
394
+ --endpoint-url http://localhost:4024
395
+
396
+ # Windows - use file-based approach
397
+ $batch = @{
398
+ Changes = @(@{
399
+ Action = "CREATE"
400
+ ResourceRecordSet = @{
401
+ Name = "www.example.com"
402
+ Type = "A"
403
+ TTL = 300
404
+ ResourceRecords = @(@{ Value = "192.0.2.1" })
405
+ }
406
+ })
407
+ } | ConvertTo-Json -Depth 10
408
+ $batch | Out-File -FilePath change-batch.json
409
+ aws route53 change-resource-record-sets `
410
+ --hosted-zone-id zone-id `
411
+ --change-batch file://./change-batch.json `
412
+ --endpoint-url http://localhost:4024
518
413
  ```
519
414
 
520
- ## ⚙️ Configuração de Lambdas
415
+ Alternativa: Direto pela API REST
416
+ ```bash
417
+ curl -X POST http://localhost:4024/2013-04-01/hostedzone/zone-id/rrset \
418
+ -H "Content-Type: application/json" \
419
+ -d '{
420
+ "Name": "www.example.com",
421
+ "Type": "A",
422
+ "TTL": 300,
423
+ "ResourceRecords": [
424
+ {"Value": "192.0.2.1"}
425
+ ]
426
+ }'
427
+ ```
521
428
 
522
- Lambdas são registradas por **nome** e invocadas via API de invocação (igual à AWS real). O roteamento HTTP é feito pelo API Gateway.
429
+ #### Criar Resource Record com Weighted Routing
523
430
 
524
- ```json
525
- {
526
- "lambdas": [
527
- {
528
- "name": "my-user-function",
529
- "handler": "./src/handlers/my-user-function.js",
530
- "env": {
531
- "TABLE_NAME": "users-table",
532
- "BUCKET_NAME": "my-bucket"
431
+ Usando AWS CLI com file-based JSON (recomendado para Windows):
432
+ ```bash
433
+ # Linux/macOS - inline JSON
434
+ aws route53 change-resource-record-sets \
435
+ --hosted-zone-id zone-id \
436
+ --change-batch '{
437
+ "Changes": [{
438
+ "Action": "CREATE",
439
+ "ResourceRecordSet": {
440
+ "Name": "api.example.com",
441
+ "Type": "A",
442
+ "TTL": 60,
443
+ "SetIdentifier": "api-primary",
444
+ "Weight": 70,
445
+ "ResourceRecords": [{"Value": "192.0.2.10"}]
533
446
  }
447
+ }]
448
+ }' \
449
+ --endpoint-url http://localhost:4024
450
+
451
+ # Windows - use file-based approach
452
+ $batch = @{
453
+ Changes = @(@{
454
+ Action = "CREATE"
455
+ ResourceRecordSet = @{
456
+ Name = "api.example.com"
457
+ Type = "A"
458
+ TTL = 60
459
+ SetIdentifier = "api-primary"
460
+ Weight = 70
461
+ ResourceRecords = @(@{ Value = "192.0.2.10" })
534
462
  }
535
- ]
536
- }
463
+ })
464
+ } | ConvertTo-Json -Depth 10
465
+ $batch | Out-File -FilePath change-batch.json
466
+ aws route53 change-resource-record-sets `
467
+ --hosted-zone-id zone-id `
468
+ --change-batch file://./change-batch.json `
469
+ --endpoint-url http://localhost:4024
537
470
  ```
538
471
 
539
- ## ⚙️ Configuração SQS com Lambda Trigger
472
+ Alternativa: Direto pela API REST
473
+ ```bash
474
+ curl -X POST http://localhost:4024/2013-04-01/hostedzone/zone-id/rrset \
475
+ -H "Content-Type: application/json" \
476
+ -d '{
477
+ "Name": "api.example.com",
478
+ "Type": "A",
479
+ "TTL": 60,
480
+ "SetIdentifier": "api-primary",
481
+ "Weight": 70,
482
+ "ResourceRecords": [
483
+ {"Value": "192.0.2.10"}
484
+ ]
485
+ }'
486
+ ```
540
487
 
541
- Para disparar uma Lambda automaticamente quando uma mensagem chega na fila, use o formato de objeto na lista de filas com `lambdaName`:
488
+ #### Criar Health Check
542
489
 
543
- ```json
544
- {
545
- "lambdas": [
546
- {
547
- "name": "process-orders",
548
- "handler": "./src/handlers/process-orders.js"
490
+ Usando AWS CLI com file-based JSON (recomendado para Windows):
491
+ ```bash
492
+ # Linux/macOS - inline JSON
493
+ aws route53 create-health-check \
494
+ --caller-reference $(date +%s) \
495
+ --health-check-config '{
496
+ "Type": "HTTP",
497
+ "Protocol": "HTTP",
498
+ "IPAddress": "192.0.2.10",
499
+ "Port": 80,
500
+ "ResourcePath": "/health",
501
+ "RequestInterval": 30,
502
+ "FailureThreshold": 3,
503
+ "MeasureLatency": true
504
+ }' \
505
+ --endpoint-url http://localhost:4024
506
+
507
+ # Windows - use file-based approach
508
+ $config = @{
509
+ Type = "HTTP"
510
+ Protocol = "HTTP"
511
+ IPAddress = "192.0.2.10"
512
+ Port = 80
513
+ ResourcePath = "/health"
514
+ RequestInterval = 30
515
+ FailureThreshold = 3
516
+ MeasureLatency = $true
517
+ } | ConvertTo-Json -Depth 10
518
+ $config | Out-File -FilePath health-check-config.json
519
+ aws route53 create-health-check `
520
+ --caller-reference ([DateTime]::Now.Ticks) `
521
+ --health-check-config file://./health-check-config.json `
522
+ --endpoint-url http://localhost:4024
523
+ ```
524
+
525
+ Alternativa: Direto pela API REST
526
+ ```bash
527
+ curl -X POST http://localhost:4024/2013-04-01/healthcheck \
528
+ -H "Content-Type: application/json" \
529
+ -d '{
530
+ "HealthCheckConfig": {
531
+ "Type": "HTTP",
532
+ "Protocol": "HTTP",
533
+ "IPAddress": "192.0.2.10",
534
+ "Port": 80,
535
+ "ResourcePath": "/health",
536
+ "RequestInterval": 30,
537
+ "FailureThreshold": 3,
538
+ "MeasureLatency": true
549
539
  }
550
- ],
551
- "sqs": {
552
- "queues": [
553
- "simple-queue",
554
- {
555
- "name": "orders-queue",
556
- "lambdaName": "process-orders",
557
- "batchSize": 5
558
- }
559
- ]
560
- }
561
- }
540
+ }'
562
541
  ```
563
542
 
564
- - Filas simples (string) são criadas sem trigger
565
- - Filas com objeto aceitam `lambdaName` (nome da Lambda registrada) e `batchSize` (padrão: 10)
566
- - Quando uma mensagem é enviada para `orders-queue`, a Lambda `process-orders` é invocada automaticamente com o evento no formato SQS padrão da AWS
543
+ #### Listar Health Checks
567
544
 
568
- O handler recebe o evento no formato padrão AWS SQS:
545
+ Usando AWS CLI (recomendado):
546
+ ```bash
547
+ aws route53 list-health-checks \
548
+ --endpoint-url http://localhost:4024
549
+ ```
569
550
 
570
- ```javascript
571
- exports.handler = async (event) => {
572
- for (const record of event.Records) {
573
- const body = JSON.parse(record.body);
574
- console.log('Mensagem recebida:', body);
575
- // processar...
576
- }
551
+ Alternativa: Direto pela API REST
552
+ ```bash
553
+ curl http://localhost:4024/2013-04-01/healthcheck
554
+ ```
555
+
556
+ #### Listar Resource Records
577
557
 
578
- // Retornar batchItemFailures para reprocessar mensagens específicas
579
- return { batchItemFailures: [] };
580
- };
558
+ Usando AWS CLI (recomendado):
559
+ ```bash
560
+ aws route53 list-resource-record-sets \
561
+ --hosted-zone-id zone-id \
562
+ --endpoint-url http://localhost:4024
581
563
  ```
582
564
 
583
- ## ⚙️ Configuração API GATEWAY
565
+ Alternativa: Direto pela API REST
566
+ ```bash
567
+ curl http://localhost:4024/2013-04-01/hostedzone/zone-id/rrset
568
+ ```
584
569
 
585
- O valor do **lambdaName** deve igual ao nome Lambda que está registrada com o valor **name**. Ex: "my-user-function".
570
+ #### Resolver DNS Query (Weighted) - Custom Endpoint
586
571
 
587
- ```json
588
- {
589
- "apigateway": {
590
- "apis": [
591
- {
592
- "name": "Users API",
593
- "description": "API para gerenciamento de usuários",
594
- "endpoints": [
595
- {
596
- "path": "/user",
597
- "method": "GET",
598
- "lambdaName": "my-user-function",
599
- "integrationType": "lambda"
600
- },
601
- {
602
- "path": "/user",
603
- "method": "POST",
604
- "lambdaName": "my-user-function",
605
- "integrationType": "lambda"
606
- },
607
- {
608
- "path": "/user/{id}",
609
- "method": "GET",
610
- "lambdaName": "my-user-function",
611
- "integrationType": "lambda"
612
- },
613
- {
614
- "path": "/user/{id}",
615
- "method": "DELETE",
616
- "lambdaName": "my-user-function",
617
- "integrationType": "lambda"
618
- },
619
- {
620
- "path": "/user/{id}",
621
- "method": "ANY",
622
- "lambdaName": "my-user-function",
623
- "integrationType": "lambda"
624
- }
625
- ]
572
+ Esta operação é um endpoint customizado do simulador sem equivalente direto em AWS CLI:
573
+ ```bash
574
+ curl "http://localhost:4024/2013-04-01/resolve/api.example.com/A?queryType=weighted"
575
+ ```
576
+
577
+ #### Deletar Resource Record
578
+
579
+ Usando AWS CLI com file-based JSON (recomendado para Windows):
580
+ ```bash
581
+ # Linux/macOS - inline JSON
582
+ aws route53 change-resource-record-sets \
583
+ --hosted-zone-id zone-id \
584
+ --change-batch '{
585
+ "Changes": [{
586
+ "Action": "DELETE",
587
+ "ResourceRecordSet": {
588
+ "Name": "www.example.com",
589
+ "Type": "A",
590
+ "TTL": 300,
591
+ "ResourceRecords": [{"Value": "192.0.2.1"}]
626
592
  }
627
- ]
628
- }
629
- }
593
+ }]
594
+ }' \
595
+ --endpoint-url http://localhost:4024
596
+
597
+ # Windows - use file-based approach
598
+ $batch = @{
599
+ Changes = @(@{
600
+ Action = "DELETE"
601
+ ResourceRecordSet = @{
602
+ Name = "www.example.com"
603
+ Type = "A"
604
+ TTL = 300
605
+ ResourceRecords = @(@{ Value = "192.0.2.1" })
606
+ }
607
+ })
608
+ } | ConvertTo-Json -Depth 10
609
+ $batch | Out-File -FilePath change-batch.json
610
+ aws route53 change-resource-record-sets `
611
+ --hosted-zone-id zone-id `
612
+ --change-batch file://./change-batch.json `
613
+ --endpoint-url http://localhost:4024
630
614
  ```
631
615
 
632
- ### Método ANY
616
+ Alternativa: Direto pela API REST
617
+ ```bash
618
+ curl -X DELETE http://localhost:4024/2013-04-01/hostedzone/zone-id/rrset/www.example.com/A
619
+ ```
633
620
 
634
- Use `"method": "ANY"` para registrar um endpoint que aceita todos os verbos HTTP (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS) — equivalente ao `ANY` do AWS API Gateway real.
621
+ #### Deletar Health Check
635
622
 
636
- ```json
637
- {
638
- "path": "/webhook",
639
- "method": "ANY",
640
- "lambdaName": "my-webhook-handler",
641
- "integrationType": "lambda"
642
- }
623
+ Usando AWS CLI (recomendado):
624
+ ```bash
625
+ aws route53 delete-health-check \
626
+ --health-check-id health-check-id \
627
+ --endpoint-url http://localhost:4024
643
628
  ```
644
629
 
645
- ### API Key
630
+ Alternativa: Direto pela API REST
631
+ ```bash
632
+ curl -X DELETE http://localhost:4024/2013-04-01/healthcheck/health-check-id
633
+ ```
646
634
 
647
- O API Gateway suporta validação de API Key via header `x-api-key`. Para proteger um endpoint, declare as `apiKeys` na configuração e use `"apiKeyRequired": true` no endpoint:
635
+ #### Deletar Hosted Zone
648
636
 
649
- ```json
650
- {
651
- "apigateway": {
652
- "apiKeys": [
653
- {
654
- "name": "my-app-key",
655
- "value": "minha-chave-secreta-123"
656
- }
657
- ],
658
- "apis": [
659
- {
660
- "name": "Protected API",
661
- "endpoints": [
662
- {
663
- "path": "/protected",
664
- "method": "GET",
665
- "lambdaName": "my-user-function",
666
- "integrationType": "lambda",
667
- "apiKeyRequired": true
668
- },
669
- {
670
- "path": "/public",
671
- "method": "GET",
672
- "lambdaName": "my-user-function",
673
- "integrationType": "lambda"
674
- }
675
- ]
676
- }
677
- ]
678
- }
679
- }
637
+ Usando AWS CLI (recomendado):
638
+ ```bash
639
+ aws route53 delete-hosted-zone \
640
+ --id zone-id \
641
+ --endpoint-url http://localhost:4024
642
+ ```
643
+
644
+ Alternativa: Direto pela API REST
645
+ ```bash
646
+ curl -X DELETE http://localhost:4024/2013-04-01/hostedzone/zone-id
680
647
  ```
681
648
 
682
- Ao chamar um endpoint protegido, envie o header:
649
+ ### ACM (AWS Certificate Manager) ⭐ NEW
650
+
651
+ **Nota:** O simulador processa AWS CLI através da API REST internamente. Use `--endpoint-url http://localhost:4025` para todas as operações ACM.
683
652
 
653
+ #### Solicitar Certificado
654
+
655
+ Usando AWS CLI (recomendado):
684
656
  ```bash
685
- curl http://localhost:4567/protected \
686
- -H "x-api-key: minha-chave-secreta-123"
657
+ aws acm request-certificate \
658
+ --domain-name example.com \
659
+ --subject-alternative-names "*.example.com" "www.example.com" \
660
+ --validation-method DNS \
661
+ --certificate-type AMAZON_ISSUED \
662
+ --endpoint-url http://localhost:4025
663
+ ```
687
664
 
688
- # Sem a key → 403 Forbidden
689
- curl http://localhost:4567/protected
665
+ Alternativa: Direto pela API REST
666
+ ```bash
667
+ curl -X POST http://localhost:4025/acm/request-certificate \
668
+ -H "Content-Type: application/json" \
669
+ -d '{
670
+ "DomainName": "example.com",
671
+ "SubjectAlternativeNames": ["*.example.com", "www.example.com"],
672
+ "ValidationMethod": "DNS",
673
+ "CertificateType": "AMAZON_ISSUED"
674
+ }'
690
675
  ```
691
676
 
692
- > **Nota:** A validação de API Key só está ativa no fluxo de proxy (`/:apiId/:stageName/*`). Endpoints declarados diretamente no `aws-local-simulator.json` via `setupConfigRoutes` não aplicam a validação de API Key no momento.
677
+ #### Listar Certificados
693
678
 
694
- ### Cognito Authorizer
679
+ Usando AWS CLI (recomendado):
680
+ ```bash
681
+ aws acm list-certificates \
682
+ --endpoint-url http://localhost:4025
683
+ ```
695
684
 
696
- O API Gateway suporta autenticação via Cognito User Pools. Configure um `authorizer` na API e marque os endpoints protegidos com `"authorizerRequired": true`:
685
+ Alternativa: Direto pela API REST
686
+ ```bash
687
+ curl http://localhost:4025/acm/list-certificates
688
+ ```
697
689
 
698
- ```json
699
- {
700
- "cognito": {
701
- "userPools": [
702
- {
703
- "PoolName": "my-user-pool",
704
- "UserPoolId": "us-east-XXXXX",
705
- "ClientId": "XXXXXX",
706
- "AutoVerifiedAttributes": ["email"]
707
- }
708
- ]
709
- },
710
- "apigateway": {
711
- "apis": [
712
- {
713
- "name": "My API",
714
- "authorizer": {
715
- "type": "COGNITO_USER_POOLS",
716
- "userPoolId": "us-east-XXXXX"
717
- },
718
- "endpoints": [
719
- {
720
- "path": "/profile",
721
- "method": "GET",
722
- "lambdaName": "my-user-function",
723
- "integrationType": "lambda",
724
- "authorizerRequired": true
725
- },
726
- {
727
- "path": "/public",
728
- "method": "GET",
729
- "lambdaName": "my-user-function",
730
- "integrationType": "lambda"
731
- }
732
- ]
733
- }
734
- ]
735
- }
736
- }
690
+ #### Listar Certificados com Filtro (Status)
691
+
692
+ Usando AWS CLI (recomendado):
693
+ ```bash
694
+ aws acm list-certificates \
695
+ --certificate-statuses ISSUED \
696
+ --endpoint-url http://localhost:4025
737
697
  ```
738
698
 
739
- O simulador valida o JWT do Cognito local no header `Authorization: Bearer <token>`. Se o token for inválido ou ausente, retorna `401 Unauthorized`.
699
+ Alternativa: Direto pela API REST
700
+ ```bash
701
+ curl "http://localhost:4025/acm/list-certificates?Status=ISSUED"
702
+ ```
740
703
 
704
+ #### Descrever Certificado
705
+
706
+ Usando AWS CLI (recomendado):
741
707
  ```bash
742
- # 1. Autenticar e obter o token
743
- TOKEN=$(curl -s -X POST http://localhost:9229/ \
744
- -H "Content-Type: application/x-amz-json-1.1" \
745
- -H "X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth" \
746
- -d '{
747
- "AuthFlow": "USER_PASSWORD_AUTH",
748
- "ClientId": "XXXXXX",
749
- "AuthParameters": {
750
- "USERNAME": "usuario@email.com",
751
- "PASSWORD": "Senha@123"
752
- }
753
- }' | jq -r '.AuthenticationResult.IdToken')
708
+ aws acm describe-certificate \
709
+ --certificate-arn arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012 \
710
+ --endpoint-url http://localhost:4025
711
+ ```
712
+
713
+ Alternativa: Direto pela API REST
714
+ ```bash
715
+ curl http://localhost:4025/acm/describe-certificate/arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012
716
+ ```
754
717
 
755
- # 2. Chamar endpoint protegido com o token
756
- curl http://localhost:4567/profile \
757
- -H "Authorization: Bearer $TOKEN"
718
+ #### Validar Domínio (DNS validation) - Custom Endpoint
758
719
 
759
- # Sem token → 401 Unauthorized
760
- curl http://localhost:4567/profile
720
+ Esta operação é um endpoint customizado do simulador sem equivalente direto em AWS CLI:
721
+ ```bash
722
+ curl -X POST http://localhost:4025/acm/validate-domain \
723
+ -H "Content-Type: application/json" \
724
+ -d '{
725
+ "CertificateArn": "arn:aws:acm:...",
726
+ "DomainName": "example.com"
727
+ }'
761
728
  ```
762
729
 
763
- O token decodificado fica disponível no Lambda em `event.requestContext.authorizer.claims`:
730
+ #### Adicionar Tags ao Certificado
764
731
 
765
- ```javascript
766
- exports.handler = async (event) => {
767
- const claims = event.requestContext.authorizer?.claims;
768
- const userId = claims?.sub;
769
- const email = claims?.email;
732
+ Usando AWS CLI (recomendado):
733
+ ```bash
734
+ aws acm add-tags-to-certificate \
735
+ --certificate-arn arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012 \
736
+ --tags Key=Environment,Value=production Key=Team,Value=platform \
737
+ --endpoint-url http://localhost:4025
738
+ ```
770
739
 
771
- return {
772
- statusCode: 200,
773
- body: JSON.stringify({ userId, email })
774
- };
775
- };
740
+ Alternativa: Direto pela API REST
741
+ ```bash
742
+ curl -X POST http://localhost:4025/acm/add-tags-to-certificate \
743
+ -H "Content-Type: application/json" \
744
+ -d '{
745
+ "CertificateArn": "arn:aws:acm:...",
746
+ "Tags": [
747
+ {"Key": "Environment", "Value": "production"},
748
+ {"Key": "Team", "Value": "platform"}
749
+ ]
750
+ }'
776
751
  ```
777
752
 
778
- O handler deve exportar uma função padrão:
753
+ #### Renovar Certificado
779
754
 
780
- ```javascript
781
- exports.handler = async (event, context) => {
782
- return {
783
- statusCode: 200,
784
- body: JSON.stringify({ message: 'Hello from Lambda!' })
785
- };
786
- };
755
+ Usando AWS CLI (recomendado):
756
+ ```bash
757
+ aws acm renew-certificate \
758
+ --certificate-arn arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012 \
759
+ --endpoint-url http://localhost:4025
787
760
  ```
788
761
 
789
- ## 📁 Estrutura de Dados
762
+ Alternativa: Direto pela API REST
763
+ ```bash
764
+ curl -X POST http://localhost:4025/acm/renew-certificate \
765
+ -H "Content-Type: application/json" \
766
+ -d '{
767
+ "CertificateArn": "arn:aws:acm:..."
768
+ }'
769
+ ```
790
770
 
791
- Os dados são persistidos em:
771
+ #### Listar Certificados por Domínio - Custom Endpoint
792
772
 
793
- ```text
794
- .aws-local-simulator-data/
795
- ├── dynamodb/
796
- ├── s3/
797
- ├── sqs/
798
- ├── cognito/
799
- ├── apigateway/
800
- ├── ecs/
801
- ├── kms/
802
- ├── secret-manager/
803
- ├── parameter-store/
804
- ├── cloudwatch/
805
- ├── cloudtrail/
806
- ├── cloudformation/
807
- ├── athena/
808
- ├── xray/
809
- └── config/
773
+ Esta operação é um endpoint customizado do simulador sem equivalente direto em AWS CLI:
774
+ ```bash
775
+ curl http://localhost:4025/acm/certificate-by-domain/example.com
810
776
  ```
811
777
 
812
- ## 🐛 Debug
778
+ #### Estatísticas de Certificados - Custom Endpoint
813
779
 
780
+ Esta operação é um endpoint customizado do simulador sem equivalente direto em AWS CLI:
814
781
  ```bash
815
- AWS_LOCAL_SIMULATOR_LOG=verbose npx aws-local-simulator start
782
+ curl http://localhost:4025/acm/stats
816
783
  ```
817
784
 
785
+ #### Deletar Certificado
786
+
787
+ Usando AWS CLI (recomendado):
788
+ ```bash
789
+ aws acm delete-certificate \
790
+ --certificate-arn arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012 \
791
+ --endpoint-url http://localhost:4025
792
+ ```
793
+
794
+ Alternativa: Direto pela API REST
795
+ ```bash
796
+ curl -X DELETE http://localhost:4025/acm/delete-certificate/arn:aws:acm:...
797
+ ```
798
+
799
+ [Exemplos completos por serviço →](docs/services/)
800
+
801
+ ## 📖 Glossário
802
+
803
+ | Termo | Descrição |
804
+ |-------|-----------|
805
+ | **VPC** | Virtual Private Cloud - rede isolada |
806
+ | **Subnet** | Segmento de VPC em uma availability zone |
807
+ | **Security Group** | Firewall virtual para instâncias |
808
+ | **Route Table** | Define rotas de rede dentro da VPC |
809
+ | **IAM** | Identity and Access Management - controle de acesso |
810
+ | **Lambda** | Computação serverless - execute funções sem gerenciar servidores |
811
+ | **DynamoDB** | Banco de dados NoSQL gerenciado |
812
+ | **SQS** | Simple Queue Service - fila de mensagens |
813
+ | **Kinesis** | Streaming de dados em tempo real |
814
+ | **Athena** | Consultas SQL interativas em dados armazenados no S3 |
815
+ | **AWS Config** | Rastreie configurações de recursos e conformidade |
816
+ | **AWS Organizations** | Gerenciar múltiplas contas AWS e aplicar políticas |
817
+ | **Control Tower** | Configurar e governar ambientes multi-conta em larga escala |
818
+ | **CloudFormation** | Infrastructure as Code - provisione recursos via templates |
819
+
818
820
  ## 🤝 Contribuindo
819
821
 
820
- 1. Fork o projeto
821
- 2. Crie sua feature branch (`git checkout -b feature/AmazingFeature`)
822
- 3. Commit suas mudanças (`git commit -m 'Add some AmazingFeature'`)
823
- 4. Push para a branch (`git push origin feature/AmazingFeature`)
824
- 5. Abra um Pull Request
822
+ Veja [CONTRIBUTING.md](CONTRIBUTING.md)
825
823
 
826
824
  ## 📄 Licença
827
825
 
828
- MIT © Luiz Gustavo Ribeiro
826
+ MIT - Licença completa em [LICENSE](LICENSE)
827
+
828
+ ## 📞 Suporte
829
+
830
+ - 📚 [Documentação Completa](docs/)
831
+ - 🐛 [Reportar Issues](https://github.com/gugananuvem/aws-local-simulator/issues)
832
+ - 💬 [Discussões](https://github.com/gugananuvem/aws-local-simulator/discussions)
833
+
834
+ ---
829
835
 
830
- ## ⚠️ Limitações
836
+ **Versão**: 1.0.0
837
+ **Última atualização**: Outubro 2024
831
838
 
832
- - ECS/Fargate em desenvolvimento
833
- - WebSocket APIs em desenvolvimento
834
- - Para uso em desenvolvimento e testes apenas