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.30.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7050610d0f77864488c89c8fc2a55ecfb785085df6553581e0e8caadf6921005 |
|
MD5 | f957b4cc1ffe858683faf51a7d2b8f67 |
|
BLAKE2b-256 | bbeae0fae97f3f593cb331da201cb76700d7530fc938e6d62575a945ba297e93 |
Close
Hashes for well_architected_constructs-0.0.30-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc96bb1f2ffe09a52146ff8a9c030ed816c70273f1a6683a7540f4b01b8aa1f2 |
|
MD5 | bdecb497fc99248a2a44d927388c6395 |
|
BLAKE2b-256 | a553a2ef3e34221499caef30b112d8427029657a0bc314f5557e23e4d9178386 |