def __init__()

in ec2-spot-history-notebook/cdk/spot_historic_notebook/spot_historic_notebook_stack.py [0:0]


    def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
        super().__init__(scope, id, **kwargs)

        # Create role for Notebook instance
        nrole = iam_.Role(
            self,
            "notebookAccessRole",
            assumed_by=iam_.ServicePrincipal("sagemaker")
        )

        nrole.add_managed_policy(iam_.ManagedPolicy.from_aws_managed_policy_name('AmazonSageMakerFullAccess'))
        nrole.add_managed_policy(iam_.ManagedPolicy.from_aws_managed_policy_name('AmazonEC2ReadOnlyAccess'))
        notebook_uuid=str(uuid.uuid4())
        notebook_uuid=str(notebook_uuid[0:notebook_uuid.find('-')])
        notebook_instance_id = 'spot-history-notebook-'+notebook_uuid

        notebook_instance = sagemaker_.CfnNotebookInstance(
            self,
            notebook_instance_id,
            instance_type='ml.m5.xlarge',
            volume_size_in_gb=10,
            security_group_ids=default_sg,
            subnet_id=default_subnet,
            notebook_instance_name=notebook_instance_id,
            role_arn=nrole.role_arn,
            default_code_repository=github_repo,
        )

        notebook_url = "https://{}.console.aws.amazon.com/sagemaker/home?region={}#/notebook-instances/openNotebook/{}?view=classic".format(
            my_region,
            my_region,
            notebook_instance.notebook_instance_name
        )

        core.CfnOutput(
            self,
            "Notebook Name",
            value=notebook_url,
            description="Notebook Instance Name",
        )