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.18.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84f744b137e6dad968e14d2a20dcd2791806d32e1e10c6fd5844dfd8385ce426 |
|
MD5 | 405909a53d5a0e1ad7f561bb1560f78c |
|
BLAKE2b-256 | 41a11b2023d2af8a2a1102387af13e992acc47f51a2c25cec538eec43d7ac4fc |
Close
Hashes for well_architected_constructs-0.0.18-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 524fa26fdb2dad4be8c989be8781c52f54231348a27a94ed334cf165da211e6f |
|
MD5 | c2e2887e621afff939101f18ae68124f |
|
BLAKE2b-256 | 7850591833f45d49babe3e3283e1a743713d138f8c62fb890f330979a9781472 |