feat: Add AWS IAM authentication support for MySQL

- Add @aws-sdk/rds-signer dependency for RDS auth token generation
- Extend CLI arguments with --aws-iam-auth and --aws-region options
- Implement automatic AWS RDS auth token generation in MySQL adapter
- Auto-enable SSL for AWS IAM authentication (required by RDS)
- Add comprehensive error handling for AWS credential issues
- Update documentation with AWS IAM authentication examples
- Maintain backward compatibility with existing authentication methods

Resolves the need for secure AWS RDS connections without hardcoded passwords.
This commit is contained in:
Fabrizio Ferrigno
2025-07-16 17:20:37 +02:00
parent 70d1b96f2c
commit 72325c95a3
6 changed files with 1463 additions and 9 deletions

View File

@@ -75,18 +75,29 @@ node dist/src/index.js --postgresql --host dbserver.example.com --database sampl
| `--mysql` | Specifies MySQL mode | - | Yes |
| `--host` | MySQL hostname or IP | - | Yes |
| `--database` | Database name | - | Yes |
| `--user` | MySQL username | - | No |
| `--password` | MySQL password | - | No |
| `--user` | MySQL username | - | No* |
| `--password` | MySQL password | - | No* |
| `--port` | MySQL port | 3306 | No |
| `--ssl` | Use SSL connection (true/false or object) | false | No |
| `--connection-timeout` | Connection timeout in ms | 30000 | No |
| `--aws-iam-auth` | Enable AWS IAM authentication | false | No |
| `--aws-region` | AWS region for RDS IAM auth | - | No** |
### Example
*Required for standard authentication
**Required when using `--aws-iam-auth`
### Standard Authentication Example
```bash
node dist/src/index.js --mysql --host localhost --database sample_db --port 3306 --user root --password secret
```
### AWS IAM Authentication Example
```bash
node dist/src/index.js --mysql --aws-iam-auth --host rds-endpoint.region.rds.amazonaws.com --database sample_db --user aws-username --aws-region us-east-1
```
## Environment Variables
Instead of specifying sensitive credentials on the command line, you can use environment variables: