Skip to content

Instantly share code, notes, and snippets.

View m-zare's full-sized avatar

Mostafa Zare m-zare

View GitHub Profile
@m-zare
m-zare / MultiCDKToolkit.md
Last active February 3, 2022 11:56
How to create multiple CDKToolkit in an environment.

Bootstrap the account with a custom Qualifier for the CDKToolkit.

cdk bootstrap --qualifier DESIRED_QUALIFIER --toolkit-stack-name DESIRED_CDKToolkit_NAME

Using the custom CDKToolkit in the CDK code,

@m-zare
m-zare / custom_resource.py
Created November 2, 2021 14:39
State Machine executer
def execute_statemachine(self, arn, region):
# https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html
create_update_action = cr.AwsSdkCall(
service="StepFunctions",
action="startExecution",
parameters={"stateMachineArn": arn},
# Physical resource id is the time of running the stack.
# It is to run this resource each time the stack is deployed.
physical_resource_id=cr.PhysicalResourceId.of(
str(int(datetime.datetime.now().timestamp()))