CDK constructs based on the Well Architected Framework
Project description
Well Architected
Python Well-Architected CDK Patterns from https://cdkpatterns.com/patterns/well-architected/
Available Constructs
- Api
- ApiLambda
- ApiLambdaDynamodb
- DynamodbTable
- HttpApiStepFunctions
- LambdaFunction
- RestApi
- RestApiSns
- SnsLambda
- WebApplicationFirewall
Examples
Creating a Stack using Well Architected Constructs
import constructs
import well_architected_constructs.web_application_firewall
import well_architected_constructs.api_lambda_dynamodb
import well_architected_stack
class WafApiLambdaDynamodb(well_architected_stack.Stack):
def __init__(
self, scope: constructs.Construct, id: str,
partition_key='path',
sort_key=None,
**kwargs
):
super().__init__(scope, id, **kwargs)
self.name = self.camel_to_snake(id)
self.api_lambda_dynamodb = well_architected_constructs.api_lambda_dynamodb.ApiLambdaDynamodbConstruct(
self, 'ApiLambdaDynamoDb',
function_name=self.name,
partition_key=partition_key,
error_topic=self.error_topic,
)
self.web_application_firewall = well_architected_constructs.web_application_firewall.WebApplicationFirewall(
self, 'WebApplicationFirewall',
error_topic=self.error_topic,
target_arn= f"arn:aws:apigateway:region::/restapis/{self.api_lambda_dynamodb.rest_api.api_id}/stages/{self.api_lambda_dynamodb.rest_api.api.deployment_stage.stage_name}",
)
@staticmethod
def camel_to_snake(text):
return ''.join([
'_'+character.lower()
if character.isupper()
else character
for character in text
]).lstrip('_')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for well_architected_constructs-0.0.23.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 457060ba372c357773c72441cc65221689256bdbe9d1b1eb2de0c726f079b621 |
|
MD5 | 0495d922fea8574e566a948551e2d2ef |
|
BLAKE2b-256 | 0bfafaded6d7957d7e95aff81d20401afdc0c37cb87226b8c3215d49f03e7144 |
Close
Hashes for well_architected_constructs-0.0.23-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d24bb04fbce8fe0e0fce67b5e2256da08439a3f0e81e9d47c14e5fedbfb2ce2 |
|
MD5 | eb964d5d5436e8e6dc322ba0c17280c9 |
|
BLAKE2b-256 | 640db6c0134ba58438a5a426cdae4aa12246fbc98a1a426254cb308ce31bf954 |