View a markdown version of this page

사전 조건 - Amazon SageMaker AI

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

사전 조건

다중 회전 RL은 SageMaker AI CreateJob API를 사용합니다.이 API에는 기존 모델 사용자 지정 사전 조건 외에도 추가 권한이 필요합니다. 아래 표에는 새로운 내용과 이미 다룬 내용이 요약되어 있습니다.

무엇 Status 참고
신뢰 정책: job.sagemaker.amazonaws.com New CreateJob API에 필요
신뢰 정책: bedrock-agentcore.amazonaws.com New 에이전트 런타임 역할에 필요(AgentCore 경로만 해당)
PassRole: job.sagemaker.amazonaws.com New 기존 사전 요구 사항은 sagemaker.amazonaws.com 적용됩니다.
작업 작업(CreateJob, DescribeJob 등) New AmazonSageMakerFullAccess에 없음
bedrock-agentcore:ListAgentRuntimes New Studio 런타임 선택기에 필요
bedrock-agentcore:ListAgentRuntimeVersions New Studio 버전 선택기에 필요
AmazonSageMakerJobFullAccess 관리형 정책 New 작업 실행 역할에 연결
AmazonSageMakerJobRuntimeAccess 관리형 정책 New 에이전트 런타임 역할에 연결
Lambda, Bedrock 배포, S3, KMS, MLflow, CloudWatch 이미 적용됨 기존 사전 요구 사항 또는 관리형 정책을 통해

호출자 역할

{ "Version": "2012-10-17", "Statement": [ { "Sid": "PassRoleForCreateJob", "Effect": "Allow", "Action": "iam:PassRole", "Resource": "arn:aws:iam::<account-id>:role/<ExecutionRoleName>", "Condition": { "StringEquals": { "iam:PassedToService": "job.sagemaker.amazonaws.com" } } }, { "Sid": "MTRLJobActions", "Effect": "Allow", "Action": [ "sagemaker:CreateJob", "sagemaker:DescribeJob", "sagemaker:StopJob", "sagemaker:DeleteJob" ], "Resource": "arn:aws:sagemaker:*:*:job/*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "MTRLListJobsPermission", "Effect": "Allow", "Action": [ "sagemaker:ListJobs", "sagemaker:ListJobSchemaVersions", "sagemaker:DescribeJobSchemaVersion" ], "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } } ] }

PassRole - 호출자가 실행 역할을에 위임할 수 있습니다job.sagemaker.amazonaws.com.

관리형 정책

멀티턴 RL은 두 가지 AWS 관리형 정책을 사용합니다. 작업을 생성하기 전에 각를 적절한 역할에 연결합니다.

AmazonSageMakerJobFullAccess - SageMaker AI 작업 실행 역할(RoleArn에 전달하는 )에 연결합니다CreateJob.

이 정책은 작업 실행 중에 필요한 권한을 부여합니다. S3의 훈련 데이터 및 체크포인트에 대한 읽기/쓰기 액세스, S3-side 암호화에 대한 KMS 권한, SageMaker AI 허브 콘텐츠 및 모델 패키지에 대한 액세스, MLflow 실험 추적, Bedrock AgentCore 또는 Lambda를 통한 에이전트 호출, VPC 네트워크 인터페이스 관리, CloudWatch Logs 쓰기. 참조: AmazonSageMakerJobFullAccess.

AmazonSageMakerJobRuntimeAccess - 에이전트 런타임 역할( Bedrock AgentCore에서 또는 Lambda 전달자 뒤에서 에이전트가 실행되는 역할)에 연결합니다. 이 정책은 롤아웃 중에 에이전트가 호출하는 sagemaker:Sample, , sagemaker:SampleWithResponseStream, sagemaker:UpdateReward및 런타임 APIssagemaker:CompleteRollout를 부여합니다sagemaker:CallWithBearerToken. 참조: AmazonSageMakerJobRuntimeAccess.

신뢰 정책 업데이트

실행 역할의 신뢰 정책에를 추가합니다job.sagemaker.amazonaws.com.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "job.sagemaker.amazonaws.com" }, "Action": ["sts:AssumeRole", "sts:TagSession"] } ] }

Bedrock AgentCore를 사용하는 경우 에이전트 런타임 역할에는 자체 신뢰 정책도 필요합니다.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "bedrock-agentcore.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }

Studio UI에 대한 추가 인라인 정책

SageMaker AI Studio를 통해 작업을 제출하는 경우 SageMaker AI 도메인 실행 역할에 다음 인라인 정책을 추가합니다.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "MTRLJobActions", "Effect": "Allow", "Action": [ "sagemaker:CreateJob", "sagemaker:DescribeJob", "sagemaker:StopJob", "sagemaker:DeleteJob", "sagemaker:ListJobs", "sagemaker:ListJobSchemaVersions", "sagemaker:DescribeJobSchemaVersion" ], "Resource": "arn:aws:sagemaker:*:*:job/*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "BedrockAgentCoreListPermissions", "Effect": "Allow", "Action": [ "bedrock-agentcore:ListAgentRuntimes", "bedrock-agentcore:ListAgentRuntimeVersions" ], "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "PassRoleForCreateJob", "Effect": "Allow", "Action": "iam:PassRole", "Resource": "arn:aws:iam::*:role/*", "Condition": { "StringEquals": { "iam:PassedToService": "job.sagemaker.amazonaws.com", "aws:ResourceAccount": "${aws:PrincipalAccount}" } } } ] }

사용자 지정 정책 옵션

AWS 관리형 정책을 사용하는 대신 자체 정책을 정의하려면 다음을 시작점으로 사용합니다.

SageMaker AI 작업 실행 역할 정책(에 해당AmazonSageMakerJobFullAccess):

{ "Version": "2012-10-17", "Statement": [ { "Sid": "S3Permissions", "Effect": "Allow", "Action": [ "s3:GetObject", "s3:PutObject", "s3:ListBucket" ], "Resource": "*", "Condition": { "StringEquals": { "s3:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "KMSPermissions", "Effect": "Allow", "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": "arn:aws:kms:*:*:key/*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" }, "StringLike": { "kms:ViaService": "s3.*.amazonaws.com" } } }, { "Sid": "KMSDescribeKey", "Effect": "Allow", "Action": "kms:DescribeKey", "Resource": "arn:aws:kms:*:*:key/*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "SageMakerHubPermissions", "Effect": "Allow", "Action": [ "sagemaker:DescribeHubContent" ], "Resource": [ "arn:aws:sagemaker:*:*:hub/*", "arn:aws:sagemaker:*:*:hub-content/*" ], "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "SageMakerModelPackagePermissions", "Effect": "Allow", "Action": [ "sagemaker:AccessModelPackage", "sagemaker:CreateModelPackage", "sagemaker:DescribeModelPackage", "sagemaker:DescribeModelPackageGroup" ], "Resource": [ "arn:aws:sagemaker:*:*:model-package/*", "arn:aws:sagemaker:*:*:model-package-group/*" ], "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "MLflowPermissions", "Effect": "Allow", "Action": [ "sagemaker:DescribeMlflowApp", "sagemaker:CallMlflowAppApi", "sagemaker-mlflow:CreateExperiment", "sagemaker-mlflow:CreateRun", "sagemaker-mlflow:UpdateRun", "sagemaker-mlflow:LogBatch", "sagemaker-mlflow:GetExperimentByName", "sagemaker-mlflow:GetMetricHistory", "sagemaker-mlflow:GetRun", "sagemaker-mlflow:StartTrace", "sagemaker-mlflow:EndTrace", "sagemaker-mlflow:SearchTraces", "sagemaker-mlflow:ListArtifacts" ], "Resource": [ "arn:aws:sagemaker:*:*:mlflow-app/*" ], "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "BedrockAgentCorePermissions", "Effect": "Allow", "Action": [ "bedrock-agentcore:InvokeAgentRuntime", "bedrock-agentcore:StopRuntimeSession", "bedrock-agentcore:GetAgentRuntime" ], "Resource": "arn:aws:bedrock-agentcore:*:*:runtime/*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "EC2NetworkPermissions", "Effect": "Allow", "Action": [ "ec2:CreateNetworkInterface", "ec2:CreateNetworkInterfacePermission", "ec2:DescribeNetworkInterfaces", "ec2:DescribeVpcs", "ec2:DescribeSubnets", "ec2:DescribeSecurityGroups", "ec2:DescribeDhcpOptions" ], "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "EC2NetworkInterfaceTagPermissions", "Effect": "Allow", "Action": [ "ec2:CreateTags" ], "Resource": "arn:aws:ec2:*:*:network-interface/*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}", "ec2:CreateAction": "CreateNetworkInterface" } } }, { "Sid": "EC2NetworkInterfaceDeletePermissions", "Effect": "Allow", "Action": [ "ec2:DeleteNetworkInterface", "ec2:DeleteNetworkInterfacePermission" ], "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "CloudWatchLogsPermissions", "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents", "logs:DescribeLogStreams" ], "Resource": "arn:aws:logs:*:*:log-group:/aws/sagemaker/*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "LambdaPermissions", "Effect": "Allow", "Action": [ "lambda:InvokeFunction" ], "Resource": "arn:aws:lambda:*:*:function:*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } } ] }

실행 역할에 대한 신뢰 관계:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "job.sagemaker.amazonaws.com" }, "Action": ["sts:AssumeRole", "sts:TagSession"] } ] }

AmazonSageMakerJobRuntimeAccess 동급 + BedrockAgentCoreFullAccess

{ "Version": "2012-10-17", "Statement": [ { "Sid": "SageMakerJobRuntimePermissions", "Effect": "Allow", "Action": [ "sagemaker:Sample", "sagemaker:SampleWithResponseStream", "sagemaker:CompleteRollout", "sagemaker:UpdateReward" ], "Resource": "arn:aws:sagemaker:*:*:job/*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "BearerTokenPermissions", "Effect": "Allow", "Action": [ "sagemaker:CallWithBearerToken" ], "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } } ] }

에이전트 런타임 역할에 대한 신뢰 관계:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "bedrock-agentcore.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }

Lambda 전달자 메모

기존 모델 사용자 지정 Lambda 권한은 이름에 SageMaker 또는 Sagemaker가 있는 함수를 포함합니다. Lambda 전달자가 다른 이름 지정 규칙을 사용하는 경우 ARN을 명시적으로 추가합니다.

{ "Sid": "CustomAgentLambdaPermission", "Effect": "Allow", "Action": ["lambda:InvokeFunction"], "Resource": "arn:aws:lambda:*:*:function:your-agent-forwarder-function-name", "Condition": { "StringEquals": {"aws:ResourceAccount": "${aws:PrincipalAccount}"} } }

기타 설정