SageMaker notebook not placed in VPC 이 페이지는 아직 한국어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우
언제든지 연락주시기 바랍니다. Id: cloudformation-aws-sagemaker-notebook-not-placed-in-vpc
Provider: AWS
Platform: CloudFormation
Severity: Medium
Category: Networking and Firewall
Learn More Description SageMaker notebook instances must be launched inside a VPC to prevent unintended public network exposure. This also enables network controls such as security groups, VPC endpoints, and flow logging.
In CloudFormation, AWS::SageMaker::NotebookInstance resources must include the Properties.SubnetId property and reference a subnet in the intended VPC. Also specify Properties.SecurityGroupIds to restrict inbound access, and configure any required VPC endpoints (for example, for S3 and ECR). Resources missing SubnetId will be flagged.
Secure configuration example:
MyNotebook :
Type : AWS::SageMaker::NotebookInstance
Properties :
NotebookInstanceName : my-notebook
InstanceType : ml.t2.medium
SubnetId : subnet-0123456789abcdef0
SecurityGroupIds :
- sg-0123456789abcdef0
Compliant Code Examples AWSTemplateFormatVersion : "2010-09-09"
Description : "NotebookInstance"
Resources :
NotebookInstance :
Type : "AWS::SageMaker::NotebookInstance"
DependsOn : [ MountTarget1, MountTarget2, MountTarget3, VpcS3Endpoint ]
Properties :
NotebookInstanceName : !Ref NotebookInstanceName
InstanceType : !Ref NotebookInstanceType
RoleArn : !GetAtt ExecutionRole.Arn
RootAccess : Enabled
SecurityGroupIds :
- !GetAtt VpcSecurityGroup.GroupId
SubnetId : !Ref PrivateSubnet1
DirectInternetAccess : Disabled
AdditionalCodeRepositories : !If
- CreateCodeRepo
- [ !GetAtt CodeRepo.CodeRepositoryName]
- !Ref 'AWS::NoValue'
LifecycleConfigName : !GetAtt NotebookStartConfig.NotebookInstanceLifecycleConfigName
VolumeSizeInGB : !Ref EbsVolumeSize
Tags :
- Key : Name
Value : !Ref 'AWS::StackName'
Vpc :
Type : 'AWS::EC2::VPC'
Properties :
CidrBlock : !Ref VpcCIDR
EnableDnsSupport : 'true'
EnableDnsHostnames : 'true'
Tags :
- Key : Name
Value : !Ref 'AWS::StackName'
Non-Compliant Code Examples AWSTemplateFormatVersion : "2010-09-09"
Description : "NotebookInstance"
Resources :
NotebookInstance :
Type : "AWS::SageMaker::NotebookInstance"
DependsOn : [ MountTarget1, MountTarget2, MountTarget3, VpcS3Endpoint ]
Properties :
NotebookInstanceName : !Ref NotebookInstanceName
InstanceType : !Ref NotebookInstanceType
RoleArn : !GetAtt ExecutionRole.Arn
RootAccess : Enabled
SecurityGroupIds :
- !GetAtt VpcSecurityGroup.GroupId
DirectInternetAccess : Disabled
AdditionalCodeRepositories : !If
- CreateCodeRepo
- [ !GetAtt CodeRepo.CodeRepositoryName]
- !Ref 'AWS::NoValue'
LifecycleConfigName : !GetAtt NotebookStartConfig.NotebookInstanceLifecycleConfigName
VolumeSizeInGB : !Ref EbsVolumeSize
Tags :
- Key : Name
Value : !Ref 'AWS::StackName'
Vpc :
Type : 'AWS::EC2::VPC'
Properties :
CidrBlock : !Ref VpcCIDR
EnableDnsSupport : 'true'
EnableDnsHostnames : 'true'
Tags :
- Key : Name
Value : !Ref 'AWS::StackName'