AWSTemplateFormatVersion: "2010-09-09" Description: "Create SageMaker notebook instance with demo notebooks loaded. (qs-1r18anahd)" Parameters: QSS3BucketName: AllowedPattern: ^[0-9a-zA-Z]+([0-9a-zA-Z-]*[0-9a-zA-Z])*$ Default: aws-quickstart Type: String QSS3KeyPrefix: AllowedPattern: ^[0-9a-zA-Z-/]*$ Default: quickstart-aws-utility-meter-data-analytics-platform/ Type: String Resources: SageMakerRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Effect: Allow Principal: Service: - sagemaker.amazonaws.com Action: - sts:AssumeRole ManagedPolicyArns: - !Sub 'arn:${AWS::Partition}:iam::aws:policy/AmazonSageMakerReadOnly' - !Sub 'arn:${AWS::Partition}:iam::aws:policy/CloudWatchLogsFullAccess' - !Sub 'arn:${AWS::Partition}:iam::aws:policy/AmazonS3FullAccess' - !Sub 'arn:${AWS::Partition}:iam::aws:policy/AWSGlueConsoleSageMakerNotebookFullAccess' Path: /service-role/ Policies: - PolicyName: !Sub "SagemakerExecution-${AWS::Region}" PolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Action: - iam:PassRole Resource: - Fn::Sub: 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/*' NotebookLifecycle: Type: AWS::SageMaker::NotebookInstanceLifecycleConfig Properties: OnStart: - Content: Fn::Base64: !Sub | #!/bin/bash -xe name="meter_demo" cd /home/ec2-user/SageMaker aws s3 cp s3://${QSS3BucketName}/${QSS3KeyPrefix}assets/notebooks/mda_demos.ipynb . # Create a Jupyter kernel for your new environment sudo -u ec2-user -i <