You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,40 @@ export class DatabaseStack extends cdk.Stack {
44
44
}
45
45
```
46
46
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
+

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
+
47
81
## Acknowledgements
48
82
The whole project inspired by [aws-cdk-dynamodb-seeder](https://github.com/elegantdevelopment/aws-cdk-dynamodb-seeder).
49
83
I though it would be very helpful to have a similar way to seed initial schema to more traditional SQL Server databases.
0 commit comments