【问题标题】:Validation error on Role name when running AWS SageMaker linear-learner locally在本地运行 AWS SageMaker 线性学习器时角色名称验证错误
【发布时间】:2021-04-01 05:58:48
【问题描述】:

我正在尝试使用 AWS SageMaker 在本地构建机器学习模型,但 IAM 角色名称出现验证错误。虽然这是我在控制台上创建的确切角色名称。

这是我的代码

    import boto3
    import sagemaker
    from sagemaker import get_execution_role
    from sagemaker.amazon.amazon_estimator import image_uris
    from sagemaker.amazon.amazon_estimator import RecordSet

    sess = sagemaker.Session()


    bucket = sagemaker.Session().default_bucket()
    prefix = 'sagemaker/ccard19'

    role ='arn:aws:iam::94911111111542:role/SageMaker-Full-Access '

    container = image_uris.retrieve('linear-learner',boto3.Session().region_name)
    
    # Some other code

   linear = sagemaker.LinearLearner(role=role,
                                               instance_count=1,
                                               instance_type='ml.m4.xlarge',
                                               predictor_type='binary_classifier')
  
  # Some other code

  ### Fit the classifier
  linear.fit([train_records,val_records,test_records], wait=True, logs='All')

这是错误信息

ClientError: An error occurred (ValidationException) when calling the CreateTrainingJob operation: 1 validation error detected: Value 'arn:aws:iam::949010940542:role/SageMaker-Full-Access ' at 'roleArn' failed to satisfy constraint: Member must satisfy regular expression pattern: ^arn:aws[a-z\-]*:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@\-_/]+$

有什么帮助吗?

【问题讨论】:

    标签: python amazon-web-services machine-learning amazon-sagemaker


    【解决方案1】:

    您的名称中有空格。应该是:

    role ='arn:aws:iam::94911111111542:role/SageMaker-Full-Access'
    

    【讨论】:

    • 我只是在尝试将笔记本移动到控制台时才注意到它。谢谢。
    猜你喜欢
    • 1970-01-01
    • 2019-05-10
    • 2020-05-26
    • 1970-01-01
    • 2019-03-14
    • 2023-03-13
    • 1970-01-01
    • 2019-06-12
    • 1970-01-01
    相关资源
    最近更新 更多