@@ -516,15 +516,6 @@ Resources:
516516 SecurityGroupIds :
517517 - !Ref NoIngressSecurityGroup
518518
519- # Service Role Access Entry, REMOVE
520- # ServiceRoleAccessEntry:
521- # Type: AWS::EKS::AccessEntry
522- # Condition: CreateEKSCluster
523- # Properties:
524- # ClusterName: !Ref EKSCluster
525- # PrincipalArn: !GetAtt ServiceRole.Arn
526- # KubernetesGroups:
527- # - 'hyperpod-node-manager'
528519
529520 VpcCNIAddOn :
530521 Type : ' AWS::EKS::Addon'
@@ -569,115 +560,50 @@ Resources:
569560 Principal :
570561 Service :
571562 - hyperpod.sagemaker.amazonaws.com
572- for GA
573- for GA
574563 - sagemaker.amazonaws.com
575- # for GA
576564 Action :
577565 - ' sts:AssumeRole'
578566 Path : /
579567 ManagedPolicyArns :
580- - ' arn:aws:iam::aws:policy/AmazonSageMakerFullAccess'
581- - ' arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly'
582- - ' arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy'
583- - ' arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy'
584- - ' arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess'
585- - ' arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore'
586- - ' arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy'
568+ - ' arn:aws:iam::aws:policy/AmazonSageMakerClusterInstanceRolePolicy'
587569 Policies :
588- - PolicyName : !Sub '${ResourceNamePrefix}-EKS-ReadOnly -${AWS::Region}'
570+ - PolicyName : !Sub '${ResourceNamePrefix}-ExecutionRolePolicy -${AWS::Region}'
589571 PolicyDocument :
590572 Version : 2012-10-17
591573 Statement :
592574 - Effect : Allow
593575 Action :
594- - ' eks:Describe*'
595- - ' eks:List*'
596- - ' eks:AccessKubernetesApi'
576+ - ' ec2:AssignPrivateIpAddresses'
577+ - ' ec2:CreateNetworkInterface'
578+ - ' ec2:CreateNetworkInterfacePermission'
579+ - ' ec2:DeleteNetworkInterface'
580+ - ' ec2:DeleteNetworkInterfacePermission'
581+ - ' ec2:DescribeNetworkInterfaces'
582+ - ' ec2:DescribeVpcs'
583+ - ' ec2:DescribeDhcpOptions'
584+ - ' ec2:DescribeSubnets'
585+ - ' ec2:DescribeSecurityGroups'
586+ - ' ec2:DetachNetworkInterface'
587+ - ' ec2:ModifyNetworkInterfaceAttribute'
588+ - ' ec2:UnassignPrivateIpAddresses'
589+ - ' ecr:BatchGetImage'
590+ - ' ecr:GetAuthorizationToken'
591+ - ' ecr:GetDownloadUrlForLayer'
592+ - ' eks-auth:AssumeRoleForPodIdentity'
597593 Resource : ' *'
598- - PolicyName : !Sub "${ResourceNamePrefix}-SageMakerClustersExecutionRoleIPv6Policy-${AWS::Region}"
599- PolicyDocument :
600- Version : 2012-10-17
601- Statement :
602- - Effect : Allow
603- Action :
604- - " ec2:AssignIpv6Addresses"
605- - " ec2:DescribeInstances"
606- - " ec2:DescribeTags"
607- - " ec2:DescribeNetworkInterfaces"
608- - " ec2:DescribeInstanceTypes"
609- Resource : " *"
610594 - Effect : Allow
611- Action :
595+ Action :
612596 - ' ec2:CreateTags'
597+ Resource : ' arn:aws:ec2:*:*:network-interface/*'
598+ - Effect : Allow
599+ Action :
600+ - ' s3:ListBucket'
601+ - ' s3:GetObject'
613602 Resource :
614- - " arn:aws:ec2:*:*:network-interface/*"
603+ - !GetAtt Bucket.Arn
604+ - !Sub ' ${Bucket.Arn}/*'
615605 RoleName : !Sub '${ResourceNamePrefix}-ExecutionRole-${AWS::Region}'
616606
617- # REMOVE
618- # ServiceRole:
619- # Type: 'AWS::IAM::Role'
620- # Properties:
621- # AssumeRolePolicyDocument:
622- # Version: 2012-10-17
623- # Statement:
624- # - Effect: Allow
625- # Principal:
626- # Service:
627- # - sagemaker.amazonaws.com
628- # - ***REMOVED***.im.aws.internal
629- # - hyperpod.sagemaker.amazonaws.com
630- # Action:
631- # - 'sts:AssumeRole'
632- # Path: /
633- # Policies:
634- # - PolicyName: !Sub '${ResourceNamePrefix}-EKS-ReadOnly'
635- # PolicyDocument:
636- # Version: 2012-10-17
637- # Statement:
638- # - Effect: Allow
639- # Action:
640- # - 'eks:DescribeCluster'
641- # Resource: '*'
642- # - PolicyName: 'SageMakerWriteLogAccess'
643- # PolicyDocument:
644- # Version: 2012-10-17
645- # Statement:
646- # - Effect: Allow
647- # Action:
648- # - 'logs:CreateLogStream'
649- # - 'logs:CreateLogGroup'
650- # - 'logs:PutLogEvents'
651- # Resource: !Sub 'arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/sagemaker/Clusters/*'
652- # RoleName: 'HyperPodServiceRoleAlternative'
653-
654- # ServiceRoleV2:
655- # Type: 'AWS::IAM::Role'
656- # Properties:
657- # AssumeRolePolicyDocument:
658- # Version: 2012-10-17
659- # Statement:
660- # - Effect: Allow
661- # Principal:
662- # Service:
663- # - sagemaker.amazonaws.com
664- # - ***REMOVED***.im.aws.internal
665- # Action:
666- # - 'sts:AssumeRole'
667- # Path: /
668- # Policies:
669- # - PolicyName: !Sub '${ResourceNamePrefix}-EKS-ReadOnly'
670- # PolicyDocument:
671- # Version: 2012-10-17
672- # Statement:
673- # - Effect: Allow
674- # Action:
675- # - 'eks:DescribeCluster'
676- # Resource: '*'
677- # RoleName: 'HyperPodServiceRoleV2Alternative'
678-
679- # ## ---------------- Lifcycle Policy Bucket ----------------###
680-
681607 Bucket :
682608 Type : ' AWS::S3::Bucket'
683609 Properties :
@@ -687,6 +613,31 @@ Resources:
687613 - ServerSideEncryptionByDefault :
688614 SSEAlgorithm : AES256
689615
616+ S3Endpoint :
617+ Type : AWS::EC2::VPCEndpoint
618+ Condition : EKSOrSubnet
619+ Properties :
620+ PolicyDocument :
621+ Version : 2012-10-17
622+ Statement :
623+ - Effect : Allow
624+ Principal : ' *'
625+ Action :
626+ - ' *'
627+ Resource :
628+ - ' *'
629+ RouteTableIds :
630+ - !Ref PrivateRouteTable
631+ ServiceName : !Join
632+ - ' '
633+ - - com.amazonaws.
634+ - !Ref AWS::Region
635+ - .s3
636+ VpcId : !If
637+ - CreateEKSCluster
638+ - !Ref VPC
639+ - !Ref VpcId
640+
690641Outputs :
691642 VPC :
692643 Condition : EKSOrSubnet
@@ -750,11 +701,6 @@ Outputs:
750701 Description : ' Execution Role Arn'
751702 Value : !GetAtt ExecutionRole.Arn
752703
753- # REMOVE
754- # AmazonSagemakerServiceRole:
755- # Description: 'Service Role Arn'
756- # Value: !GetAtt ServiceRole.Arn
757-
758704 AmazonS3BucketName :
759705 Description : ' Bucket Name'
760706 Value : !Ref Bucket
0 commit comments