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.29.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae6dcc90541db5c704ccc3c2c3227b6320789d13212359f04684a71f048b4055 |
|
MD5 | 7d600a43693b8110dd2fb18b99d72b0d |
|
BLAKE2b-256 | 09c9d90d95637eb3a40d01d63c4fc52dcaf9685e2fd99198be73868c598a14ba |
Close
Hashes for well_architected_constructs-0.0.29-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9917b74b45c6093c91a8b9b81cf7ec2b659f73fa518432c2ec709a23fabd3a17 |
|
MD5 | 4cacd0923cf1d0da716920a6048d0e1e |
|
BLAKE2b-256 | 79ac2a50447c94b91347317ff33354859a509e7fdee47d69939a682f2fb97d03 |