Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

well_architected_constructs-0.1.2.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

well_architected_constructs-0.1.2-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file well_architected_constructs-0.1.2.tar.gz.

File metadata

File hashes

Hashes for well_architected_constructs-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1c73a7fe6ac54eee7fbcaae83bbac0677e67b7ec6923d2ce8964628e89707a17
MD5 239a2ba596e15def080f436fc0d5d005
BLAKE2b-256 8a09d3b1d58219d7892c5a262047d9a23e0e2d709d66a97185afb5d700eb146a

See more details on using hashes here.

File details

Details for the file well_architected_constructs-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for well_architected_constructs-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6270c4e3de419b8e164796c91cdb150ecb52446fb2dcc88b88bc0e849ef62f88
MD5 d5620e1fe173482de66f108a5090f8da
BLAKE2b-256 a9db4af220ecea70f2bb067e8a5d38092062ece3616b52efd2d14cb3aa871148

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page