Resources: VPCB9E5F0B4: Type: AWS::EC2::VPC Properties: CidrBlock: 10.10.0.0/16 EnableDnsHostnames: true EnableDnsSupport: true InstanceTenancy: default Tags: - Key: Name Value: multinotebookefs/VPC Metadata: aws:cdk:path: multinotebookefs/VPC/Resource VPCPublicSubnet1SubnetB4246D30: Type: AWS::EC2::Subnet Properties: CidrBlock: 10.10.0.0/24 VpcId: Ref: VPCB9E5F0B4 AvailabilityZone: Fn::Select: - 0 - Fn::GetAZs: "" MapPublicIpOnLaunch: true Tags: - Key: aws-cdk:subnet-name Value: Public - Key: aws-cdk:subnet-type Value: Public - Key: Name Value: multinotebookefs/VPC/PublicSubnet1 Metadata: aws:cdk:path: multinotebookefs/VPC/PublicSubnet1/Subnet VPCPublicSubnet1RouteTableFEE4B781: Type: AWS::EC2::RouteTable Properties: VpcId: Ref: VPCB9E5F0B4 Tags: - Key: Name Value: multinotebookefs/VPC/PublicSubnet1 Metadata: aws:cdk:path: multinotebookefs/VPC/PublicSubnet1/RouteTable VPCPublicSubnet1RouteTableAssociation0B0896DC: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: Ref: VPCPublicSubnet1RouteTableFEE4B781 SubnetId: Ref: VPCPublicSubnet1SubnetB4246D30 Metadata: aws:cdk:path: multinotebookefs/VPC/PublicSubnet1/RouteTableAssociation VPCPublicSubnet1DefaultRoute91CEF279: Type: AWS::EC2::Route Properties: RouteTableId: Ref: VPCPublicSubnet1RouteTableFEE4B781 DestinationCidrBlock: 0.0.0.0/0 GatewayId: Ref: VPCIGWB7E252D3 DependsOn: - VPCVPCGW99B986DC Metadata: aws:cdk:path: multinotebookefs/VPC/PublicSubnet1/DefaultRoute VPCPublicSubnet1EIP6AD938E8: Type: AWS::EC2::EIP Properties: Domain: vpc Tags: - Key: Name Value: multinotebookefs/VPC/PublicSubnet1 Metadata: aws:cdk:path: multinotebookefs/VPC/PublicSubnet1/EIP VPCPublicSubnet1NATGatewayE0556630: Type: AWS::EC2::NatGateway Properties: AllocationId: Fn::GetAtt: - VPCPublicSubnet1EIP6AD938E8 - AllocationId SubnetId: Ref: VPCPublicSubnet1SubnetB4246D30 Tags: - Key: Name Value: multinotebookefs/VPC/PublicSubnet1 Metadata: aws:cdk:path: multinotebookefs/VPC/PublicSubnet1/NATGateway VPCPublicSubnet2Subnet74179F39: Type: AWS::EC2::Subnet Properties: CidrBlock: 10.10.1.0/24 VpcId: Ref: VPCB9E5F0B4 AvailabilityZone: Fn::Select: - 1 - Fn::GetAZs: "" MapPublicIpOnLaunch: true Tags: - Key: aws-cdk:subnet-name Value: Public - Key: aws-cdk:subnet-type Value: Public - Key: Name Value: multinotebookefs/VPC/PublicSubnet2 Metadata: aws:cdk:path: multinotebookefs/VPC/PublicSubnet2/Subnet VPCPublicSubnet2RouteTable6F1A15F1: Type: AWS::EC2::RouteTable Properties: VpcId: Ref: VPCB9E5F0B4 Tags: - Key: Name Value: multinotebookefs/VPC/PublicSubnet2 Metadata: aws:cdk:path: multinotebookefs/VPC/PublicSubnet2/RouteTable VPCPublicSubnet2RouteTableAssociation5A808732: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: Ref: VPCPublicSubnet2RouteTable6F1A15F1 SubnetId: Ref: VPCPublicSubnet2Subnet74179F39 Metadata: aws:cdk:path: multinotebookefs/VPC/PublicSubnet2/RouteTableAssociation VPCPublicSubnet2DefaultRouteB7481BBA: Type: AWS::EC2::Route Properties: RouteTableId: Ref: VPCPublicSubnet2RouteTable6F1A15F1 DestinationCidrBlock: 0.0.0.0/0 GatewayId: Ref: VPCIGWB7E252D3 DependsOn: - VPCVPCGW99B986DC Metadata: aws:cdk:path: multinotebookefs/VPC/PublicSubnet2/DefaultRoute VPCPrivateSubnet1Subnet8BCA10E0: Type: AWS::EC2::Subnet Properties: CidrBlock: 10.10.2.0/24 VpcId: Ref: VPCB9E5F0B4 AvailabilityZone: Fn::Select: - 0 - Fn::GetAZs: "" MapPublicIpOnLaunch: false Tags: - Key: aws-cdk:subnet-name Value: Private - Key: aws-cdk:subnet-type Value: Private - Key: Name Value: multinotebookefs/VPC/PrivateSubnet1 Metadata: aws:cdk:path: multinotebookefs/VPC/PrivateSubnet1/Subnet VPCPrivateSubnet1RouteTableBE8A6027: Type: AWS::EC2::RouteTable Properties: VpcId: Ref: VPCB9E5F0B4 Tags: - Key: Name Value: multinotebookefs/VPC/PrivateSubnet1 Metadata: aws:cdk:path: multinotebookefs/VPC/PrivateSubnet1/RouteTable VPCPrivateSubnet1RouteTableAssociation347902D1: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: Ref: VPCPrivateSubnet1RouteTableBE8A6027 SubnetId: Ref: VPCPrivateSubnet1Subnet8BCA10E0 Metadata: aws:cdk:path: multinotebookefs/VPC/PrivateSubnet1/RouteTableAssociation VPCPrivateSubnet1DefaultRouteAE1D6490: Type: AWS::EC2::Route Properties: RouteTableId: Ref: VPCPrivateSubnet1RouteTableBE8A6027 DestinationCidrBlock: 0.0.0.0/0 NatGatewayId: Ref: VPCPublicSubnet1NATGatewayE0556630 Metadata: aws:cdk:path: multinotebookefs/VPC/PrivateSubnet1/DefaultRoute VPCPrivateSubnet2SubnetCFCDAA7A: Type: AWS::EC2::Subnet Properties: CidrBlock: 10.10.3.0/24 VpcId: Ref: VPCB9E5F0B4 AvailabilityZone: Fn::Select: - 1 - Fn::GetAZs: "" MapPublicIpOnLaunch: false Tags: - Key: aws-cdk:subnet-name Value: Private - Key: aws-cdk:subnet-type Value: Private - Key: Name Value: multinotebookefs/VPC/PrivateSubnet2 Metadata: aws:cdk:path: multinotebookefs/VPC/PrivateSubnet2/Subnet VPCPrivateSubnet2RouteTable0A19E10E: Type: AWS::EC2::RouteTable Properties: VpcId: Ref: VPCB9E5F0B4 Tags: - Key: Name Value: multinotebookefs/VPC/PrivateSubnet2 Metadata: aws:cdk:path: multinotebookefs/VPC/PrivateSubnet2/RouteTable VPCPrivateSubnet2RouteTableAssociation0C73D413: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: Ref: VPCPrivateSubnet2RouteTable0A19E10E SubnetId: Ref: VPCPrivateSubnet2SubnetCFCDAA7A Metadata: aws:cdk:path: multinotebookefs/VPC/PrivateSubnet2/RouteTableAssociation VPCPrivateSubnet2DefaultRouteF4F5CFD2: Type: AWS::EC2::Route Properties: RouteTableId: Ref: VPCPrivateSubnet2RouteTable0A19E10E DestinationCidrBlock: 0.0.0.0/0 NatGatewayId: Ref: VPCPublicSubnet1NATGatewayE0556630 Metadata: aws:cdk:path: multinotebookefs/VPC/PrivateSubnet2/DefaultRoute VPCIGWB7E252D3: Type: AWS::EC2::InternetGateway Properties: Tags: - Key: Name Value: multinotebookefs/VPC Metadata: aws:cdk:path: multinotebookefs/VPC/IGW VPCVPCGW99B986DC: Type: AWS::EC2::VPCGatewayAttachment Properties: VpcId: Ref: VPCB9E5F0B4 InternetGatewayId: Ref: VPCIGWB7E252D3 Metadata: aws:cdk:path: multinotebookefs/VPC/VPCGW commonEFS4NotebooksF7CED3FB: Type: AWS::EFS::FileSystem Properties: BackupPolicy: Status: ENABLED Encrypted: true FileSystemTags: - Key: Name Value: multinotebookefs/commonEFS4Notebooks PerformanceMode: maxIO ThroughputMode: bursting UpdateReplacePolicy: Retain DeletionPolicy: Retain Metadata: aws:cdk:path: multinotebookefs/commonEFS4Notebooks/Resource commonEFS4NotebooksEfsSecurityGroup4863F826: Type: AWS::EC2::SecurityGroup Properties: GroupDescription: multinotebookefs/commonEFS4Notebooks/EfsSecurityGroup SecurityGroupEgress: - CidrIp: 0.0.0.0/0 Description: Allow all outbound traffic by default IpProtocol: "-1" Tags: - Key: Name Value: multinotebookefs/commonEFS4Notebooks VpcId: Ref: VPCB9E5F0B4 Metadata: aws:cdk:path: multinotebookefs/commonEFS4Notebooks/EfsSecurityGroup/Resource commonEFS4NotebooksEfsMountTarget163CB7E73: Type: AWS::EFS::MountTarget Properties: FileSystemId: Ref: commonEFS4NotebooksF7CED3FB SecurityGroups: - Fn::GetAtt: - commonEFS4NotebooksEfsSecurityGroup4863F826 - GroupId SubnetId: Ref: VPCPrivateSubnet1Subnet8BCA10E0 Metadata: aws:cdk:path: multinotebookefs/commonEFS4Notebooks/EfsMountTarget1 commonEFS4NotebooksEfsMountTarget2298AA58D: Type: AWS::EFS::MountTarget Properties: FileSystemId: Ref: commonEFS4NotebooksF7CED3FB SecurityGroups: - Fn::GetAtt: - commonEFS4NotebooksEfsSecurityGroup4863F826 - GroupId SubnetId: Ref: VPCPrivateSubnet2SubnetCFCDAA7A Metadata: aws:cdk:path: multinotebookefs/commonEFS4Notebooks/EfsMountTarget2 notebookAccessRoleFF9FFE8C: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Action: sts:AssumeRole Effect: Allow Principal: Service: sagemaker.amazonaws.com Version: "2012-10-17" Metadata: aws:cdk:path: multinotebookefs/notebookAccessRole/Resource notebookAccessPolicyFF100858: Type: AWS::IAM::Policy Properties: PolicyDocument: Statement: - Action: s3:* Effect: Allow Resource: "*" Version: "2012-10-17" PolicyName: notebookAccessPolicy Roles: - Ref: notebookAccessRoleFF9FFE8C Metadata: aws:cdk:path: multinotebookefs/notebookAccessPolicy/Resource LifeCycleConfig: Type: AWS::SageMaker::NotebookInstanceLifecycleConfig Properties: NotebookInstanceLifecycleConfigName: CDKLifeCycleConfig OnStart: - Content: Fn::Base64: Fn::Join: - "" - - >- #!/bin/bash cd /home/ec2-user/SageMaker/ mkdir -p efs sudo yum install -y amazon-efs-utils sudo mount -t efs - Ref: commonEFS4NotebooksF7CED3FB - >- :/ efs sudo chmod go+rw ./efs Metadata: aws:cdk:path: multinotebookefs/LifeCycleConfig CDKNotebookInstanceUser0: Type: AWS::SageMaker::NotebookInstance Properties: InstanceType: ml.t2.medium RoleArn: Fn::GetAtt: - notebookAccessRoleFF9FFE8C - Arn LifecycleConfigName: CDKLifeCycleConfig NotebookInstanceName: CDK-Notebook-Instance-User-0 SecurityGroupIds: - Fn::GetAtt: - VPCB9E5F0B4 - DefaultSecurityGroup SubnetId: Ref: VPCPrivateSubnet1Subnet8BCA10E0 VolumeSizeInGB: 5 Metadata: aws:cdk:path: multinotebookefs/CDK-Notebook-Instance-User-0 CDKNotebookInstanceUser1: Type: AWS::SageMaker::NotebookInstance Properties: InstanceType: ml.t2.medium RoleArn: Fn::GetAtt: - notebookAccessRoleFF9FFE8C - Arn LifecycleConfigName: CDKLifeCycleConfig NotebookInstanceName: CDK-Notebook-Instance-User-1 SecurityGroupIds: - Fn::GetAtt: - VPCB9E5F0B4 - DefaultSecurityGroup SubnetId: Ref: VPCPrivateSubnet1Subnet8BCA10E0 VolumeSizeInGB: 5 Metadata: aws:cdk:path: multinotebookefs/CDK-Notebook-Instance-User-1 CDKNotebookInstanceUser2: Type: AWS::SageMaker::NotebookInstance Properties: InstanceType: ml.t2.medium RoleArn: Fn::GetAtt: - notebookAccessRoleFF9FFE8C - Arn LifecycleConfigName: CDKLifeCycleConfig NotebookInstanceName: CDK-Notebook-Instance-User-2 SecurityGroupIds: - Fn::GetAtt: - VPCB9E5F0B4 - DefaultSecurityGroup SubnetId: Ref: VPCPrivateSubnet1Subnet8BCA10E0 VolumeSizeInGB: 5 Metadata: aws:cdk:path: multinotebookefs/CDK-Notebook-Instance-User-2 CDKMetadata: Type: AWS::CDK::Metadata Properties: Modules: aws-cdk=1.77.0,@aws-cdk/assets=1.77.0,@aws-cdk/aws-cloudwatch=1.77.0,@aws-cdk/aws-ec2=1.77.0,@aws-cdk/aws-efs=1.77.0,@aws-cdk/aws-events=1.77.0,@aws-cdk/aws-iam=1.77.0,@aws-cdk/aws-kms=1.77.0,@aws-cdk/aws-logs=1.77.0,@aws-cdk/aws-s3=1.77.0,@aws-cdk/aws-s3-assets=1.77.0,@aws-cdk/aws-sagemaker=1.77.0,@aws-cdk/aws-ssm=1.77.0,@aws-cdk/cloud-assembly-schema=1.77.0,@aws-cdk/core=1.77.0,@aws-cdk/cx-api=1.77.0,@aws-cdk/region-info=1.77.0,jsii-runtime=Python/3.6.12 Metadata: aws:cdk:path: multinotebookefs/CDKMetadata/Default Condition: CDKMetadataAvailable Outputs: VPCid: Value: Ref: VPCB9E5F0B4 EFSid: Value: Ref: commonEFS4NotebooksF7CED3FB NotebookInstance0: Value: CDK-Notebook-Instance-User-0 NotebookInstance1: Value: CDK-Notebook-Instance-User-1 NotebookInstance2: Value: CDK-Notebook-Instance-User-2 Conditions: CDKMetadataAvailable: Fn::Or: - Fn::Or: - Fn::Equals: - Ref: AWS::Region - ap-east-1 - Fn::Equals: - Ref: AWS::Region - ap-northeast-1 - Fn::Equals: - Ref: AWS::Region - ap-northeast-2 - Fn::Equals: - Ref: AWS::Region - ap-south-1 - Fn::Equals: - Ref: AWS::Region - ap-southeast-1 - Fn::Equals: - Ref: AWS::Region - ap-southeast-2 - Fn::Equals: - Ref: AWS::Region - ca-central-1 - Fn::Equals: - Ref: AWS::Region - cn-north-1 - Fn::Equals: - Ref: AWS::Region - cn-northwest-1 - Fn::Equals: - Ref: AWS::Region - eu-central-1 - Fn::Or: - Fn::Equals: - Ref: AWS::Region - eu-north-1 - Fn::Equals: - Ref: AWS::Region - eu-west-1 - Fn::Equals: - Ref: AWS::Region - eu-west-2 - Fn::Equals: - Ref: AWS::Region - eu-west-3 - Fn::Equals: - Ref: AWS::Region - me-south-1 - Fn::Equals: - Ref: AWS::Region - sa-east-1 - Fn::Equals: - Ref: AWS::Region - us-east-1 - Fn::Equals: - Ref: AWS::Region - us-east-2 - Fn::Equals: - Ref: AWS::Region - us-west-1 - Fn::Equals: - Ref: AWS::Region - us-west-2