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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c038ab6d31f1e2858bfb5fec08f8800c03279fff3c529a447602cc81e4d6c28 |
|
MD5 | 69b62fb003ca0e940ba5dc25c984ff84 |
|
BLAKE2b-256 | eafefecfe1d6d9c5a87b4c0e5366aa26eea0ffc4ea74a6a480ee45b0eab88ba2 |
Close
Hashes for well_architected_constructs-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 253ffe618a19e1598223b6fe7d2213a84c75f637558ecca2cd6a265026e18fa7 |
|
MD5 | 0cb6955dfb5c46daa0283c38216a13ce |
|
BLAKE2b-256 | 15a08d50503e5cca919b89de2c531bea0303cd57a544182b0e3e6e04babb0632 |