def create()

in cdk/ide/lambda_functions/c9bootstrap/lambda_function.py [0:0]


def create(event, context):
    logger.debug("Got Create")
    instance_id = event["ResourceProperties"]["InstanceId"]
    bootstrap_path = event['ResourceProperties']['BootstrapPath']
    arguments = event['ResourceProperties']['BootstrapArguments']
    while True:
        commands = ['mkdir -p /tmp/setup', 'cd /tmp/setup',
                    'aws s3 cp ' + bootstrap_path + ' bootstrap.sh --quiet',
                    'sudo chmod +x bootstrap.sh', './bootstrap.sh ' + arguments]
        send_response = send_command(instance_id, commands)
        if send_response:
            helper.Data["CommandId"] = send_response['Command']['CommandId']
            break
        if context.get_remaining_time_in_millis() < 20000:
            raise Exception("Timed out attempting to send command to SSM")
        sleep(15)