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
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.2.tar.gz
(30.6 kB
view hashes)
Built Distribution
Close
Hashes for well_architected-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb5c3d20380e76a81bd7e4056a2b99e79d5193a0fe5cdb13f5e77a60edd1f188 |
|
MD5 | 578447269114f4a5564fc39ec163b08a |
|
BLAKE2b-256 | 7dfbe1f514c24d038c5bd972fe75f4b8ad54ae95f46ae08b1b734afadffb9d18 |