Skip to main content

CDK constructs and stacks based on the Well Architected Framework

Project description

Well Architected

Well-Architected CDK Patterns in Python from https://cdkpatterns.com/patterns/well-architected/

Available Stacks

  • ApiLambdaRds
  • ApiLambdaDynamodb
  • ApiLambdaDynamodbEventBridgeLambda
  • AutoscalingEcsService
  • AutoscalingEcsServiceWithPlacement
  • AutoscalingEcsCluster
  • AlbAutoscalingEcsService
  • NlbAutoscalingEcsService
  • NlbFargateService
  • NlbAutoscalingFargateService
  • ApiLambdaEventBridgeLambda
  • ApiLambdaSqsLambdaDynamodb
  • ApiSnsLambdaEventBridgeLambda
  • ApiSnsSqsLambda
  • ApiStepFunctions
  • LambdaFat
  • LambdaLith
  • LambdaPowerTuner
  • LambdaSinglePurpose
  • RestApiDynamodb
  • RestApiSns
  • S3SqsLambdaEcsEventBridgeLambdaDynamodb
  • SagaStepFunction
  • SimpleGraphqlService
  • SnsLambda
  • SnsLambdaSns
  • SnsLambdaDynamodb
  • SqsLambdaSqs
  • WafApiLambdaDynamodb

Available Constructs

  • Api
  • ApiLambda
  • ApiLambdaDynamodb
  • DynamodbTable
  • HttpApiStepFunctions
  • LambdaFunction
  • RestApi
  • RestApiSns
  • SnsLambda
  • WebApplicationFirewall

Examples

Using a Well Architected Stack

import aws_cdk
import well_architected_stacks

app = aws_cdk.App()
well_architected_stacks.api_lambda_eventbridge_lambda.ApiLambdaDynamodbEventBridgeLambda(
    app, 'ApiLambdaDynamodbEventBridgeLambda
)
app.synth()

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-1.0.3.tar.gz (30.7 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-1.0.3-py3-none-any.whl (52.7 kB view details)

Uploaded Python 3

File details

Details for the file well_architected-1.0.3.tar.gz.

File metadata

  • Download URL: well_architected-1.0.3.tar.gz
  • Upload date:
  • Size: 30.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for well_architected-1.0.3.tar.gz
Algorithm Hash digest
SHA256 759737d7172175ec61071f99269773976b0881e83f18d484cd2ace0688b4c583
MD5 fdf7c4a1a3483b08a8fcc33dabbc95f8
BLAKE2b-256 4c349c2dd56b0508fc61eca0bb692e62d2d73148290879b03dc3a9ccd4b15265

See more details on using hashes here.

File details

Details for the file well_architected-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for well_architected-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f01337e03a851e2afe6abd6d737c3f4a1e202a944da99e3b6dce4b35cef58bcd
MD5 851a0cf175c9ab1c8297f7bd722fc621
BLAKE2b-256 8a8ca706818c4fcba17465767632fe38384799fe368be3e8e3871a73d8a70368

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