Created
March 11, 2022 22:30
-
-
Save youngsoul/5741dd2b5cacb7371f79b0c045080b9b to your computer and use it in GitHub Desktop.
Lambda CDK Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lb1 = lambda_alpha_.PythonFunction(self, f"{resource_prefix}-function", | |
entry="./rds_lambda", | |
index="rds_lambda.py", | |
handler="lambda_handler", | |
runtime=_lambda.Runtime.PYTHON_3_9, | |
vpc=vpc, | |
vpc_subnets=ec2.SubnetSelection( | |
subnet_type=ec2.SubnetType.PRIVATE_WITH_NAT | |
), | |
security_groups=[ | |
lambda_to_proxy_sg | |
], | |
timeout=Duration.seconds(30), | |
environment={ | |
"RDS_HOST": proxy.endpoint, | |
"RDS_DB_NAME": db_name, | |
"SECRET_NAME": construct_id + '-rds-credentials', | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment