代码之家  ›  专栏  ›  技术社区  ›  Punter Vicky

使用assume_role_with_web_identity生成STS令牌

  •  0
  • Punter Vicky  · 技术社区  · 6 年前

    我希望在我的kubernetes pod中使用AWS_ROLE_ARN&本文档中指定的AWS_WEB_IDENTITY_TOKEN_FILE EKS Service Accounts 。是否能够使用下面的代码生成令牌,或者我应该在将令牌作为WebIdentityToken传递之前从AWS_WEB_IDENTITY_token_FILE中提取令牌?

    client = boto3.client('sts')
    response = client.assume_role_with_web_identity(
        RoleArn=os.environ['AWS_ROLE_ARN'],
        RoleSessionName='mySession',
        WebIdentityToken=os.environ['AWS_WEB_IDENTITY_TOKEN_FILE']
    )
    
    0 回复  |  直到 6 年前