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.33.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e73675c1d788bfc7a74cd850798e980e1184b343532f894bb2230d78fd51c677 |
|
MD5 | e6b9f5113197a77006997bcaba7e8b02 |
|
BLAKE2b-256 | 990aa9c6527e3f2c0ff67c93dcb5bffce10701f1a9fd11d52c278089f320bc47 |
Close
Hashes for well_architected_constructs-0.0.33-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 657d3d5dc2445a184de98c46ad61304eadb9f147f2a544bad0b07195dc25d604 |
|
MD5 | 76aa213cfe6593c17f912c2d89c4effe |
|
BLAKE2b-256 | e1ac9809132e3cbd2281a8b823bd5901a2d60781d4de958a31e441bf73bf7c21 |