def deploy(cloud_formation_script, stack_name, cf_resource):
    """
    Deploys scaffold resources used by the example. The resources are
    defined in the CloudFormation script. They're deployed as a CloudFormation stack
    so you can manage and destroy them by using CloudFormation actions.

    :param cloud_formation_script: The path to a CloudFormation script.
    :param stack_name: The name of the CloudFormation stack.
    :param cf_resource: A Boto3 CloudFormation resource.
    :return: A dict of outputs from the stack.
    """
    with open(cloud_formation_script) as setup_file:
        setup_template = setup_file.read()
    print(f"Creating {stack_name}.")
    stack = cf_resource.create_stack(
        StackName=stack_name,
        TemplateBody=setup_template,
        Capabilities=['CAPABILITY_NAMED_IAM'])
    print("Waiting for stack to deploy.  This typically takes a minute or two.")
    waiter = cf_resource.meta.client.get_waiter('stack_create_complete')
    waiter.wait(StackName=stack.name)
    stack.load()
    print(f"Stack status: {stack.stack_status}")
    print("Created resources:")
    for resource in stack.resource_summaries.all():
        print(f"\t{resource.resource_type}, {resource.physical_resource_id}")
    print("Outputs:")
    outputs = {}
    for oput in stack.outputs:
        outputs[oput['OutputKey']] = oput['OutputValue']
        print(f"\t{oput['OutputKey']}: {oput['OutputValue']}")
    return outputs