Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ $ cdk destroy
| [fargate-service-with-autoscaling](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/ecs/fargate-service-with-autoscaling/) | Starting an ECS service of FARGATE launch type that auto scales based on average CPU Utilization |
| [lambda-cron](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/lambda-cron/) | Running a Lambda on a schedule |
| [lambda-s3-trigger](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/lambda-s3-trigger/) | S3 trigger for Lambda |
| [rds](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/rds/) | Creating a MySQL RDS database inside its dedicated VPC |
| [stepfunctions](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/stepfunctions/) | A simple StepFunctions workflow |
| [url-shortner](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/url-shortener) | Demo from the [Infrastructure ***is*** Code with the AWS CDK](https://youtu.be/ZWCvNFUN-sU) AWS Online Tech Talk |

Expand Down
36 changes: 36 additions & 0 deletions python/rds/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env python3

from aws_cdk import (
aws_ec2 as ec2,
aws_rds as rds,
core,
)


class RDSStack(core.Stack):
def __init__(self, app: core.App, id: str, **kwargs) -> None:
super().__init__(app, id, **kwargs)

vpc = ec2.Vpc(self, "VPC")

rds.DatabaseInstance(
self, "RDS",
master_username="master",
master_user_password=core.SecretValue.plain_text("password"),
database_name="db1",
engine_version="8.0.16",
engine=rds.DatabaseInstanceEngine.MYSQL,
vpc=vpc,
port=3306,
instance_class=ec2.InstanceType.of(
ec2.InstanceClass.MEMORY4,
ec2.InstanceSize.LARGE,
),
removal_policy=core.RemovalPolicy.DESTROY,
deletion_protection=False
),


app = core.App()
RDSStack(app, "RDSStack")
app.synth()
3 changes: 3 additions & 0 deletions python/rds/cdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"app": "python3 app.py"
}
3 changes: 3 additions & 0 deletions python/rds/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
aws-cdk.core
aws-cdk.aws-ec2
aws-cdk.aws-rds