Skip to content

Commit b8867a6

Browse files
author
Kolomiets
committed
Add additional documentation to the readme file.
1 parent a77616d commit b8867a6

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,40 @@ export class DatabaseStack extends cdk.Stack {
4444
}
4545
```
4646

47+
## Configuration properties
48+
SqlServerSeeder construct accepts the following configuration properties:
49+
50+
| Parameter | Required | Default | Description |
51+
|---|---|---|---|
52+
| `vpc` | yes | | VPC for Lambda function deployment |
53+
| `database` | yes | | RDS SQL Server database instance |
54+
| `createScriptPath` | yes | | SQL scripts to run on resource creation |
55+
| `deleteScriptPath` | no | | SQL script to run on resource deletion |
56+
| `port` | no | 1433 | RSD SQL Server database port |
57+
| `memorySize` | no | 512 | Lambda function memory size |
58+
| `ignoreSqlErrors` | no | false | Whether to ignore SQL error or not |
59+
60+
## Architecture
61+
62+
![Architecture](/doc/architecture.png)
63+
64+
`cdk-sqlserver-seeder` deploys a custom resource backed by PowerShell lambda to connect to SQL Server instance. Lambda function is deployed in private subnets of your VPC where RDS instance resides.
65+
66+
Lambda function retrieves database credentials from [AWS Secrets Manager](https://aws.amazon.com/secrets-manager/) and uses them to construct connection string to the database.
67+
68+
SQL scripts are uploaded into S3 bucket during CDK application deployment.
69+
Lambda function downloads these scripts during execution.
70+
71+
## Security considerations
72+
Lambda function has the following permissions:
73+
74+
- Managed policies
75+
- `AWSLambdaBasicExecutionRole` for CloudWatch logs
76+
- `AWSLambdaVPCAccessExecutionRole` for VPC access
77+
- Inline policy
78+
- `secretsmanager:GetSecretValue` for RDS credentials secret
79+
- `s3:GetObject*`, `s3:GetBucket*`, `s3:List*` for S3 bucket with SQL scripts
80+
4781
## Acknowledgements
4882
The whole project inspired by [aws-cdk-dynamodb-seeder](https://github.com/elegantdevelopment/aws-cdk-dynamodb-seeder).
4983
I though it would be very helpful to have a similar way to seed initial schema to more traditional SQL Server databases.

doc/architecture.png

28.7 KB
Loading

0 commit comments

Comments
 (0)