作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们一直使用以下方法在远程机器上担任超过一个小时的角色:
# Prep environment to use roles.
unset AWS_CONFIG_FILE
unset AWS_DEFAULT_REGION
unset AWS_DEFAULT_PROFILE
CONFIG_FILE=$(mktemp)
# Creates temp file with instance profile credentials as default
# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, ROLE_ARN are available from the environment.
printf "[default]\naws_access_key_id=$AWS_ACCESS_KEY_ID\naws_secret_access_key=$AWS_SECRET_ACCESS_KEY\n[profile role_profile]\nrole_arn = $ROLE_ARN\nsource_profile = default" > $CONFIG_FILE
# make sure instance profile takes precedence
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
unset AWS_SESSION_TOKEN
export AWS_CONFIG_FILE=$CONFIG_FILE
export AWS_DEFAULT_REGION=us-east-1
export AWS_DEFAULT_PROFILE=role_profile
不幸的是,这个方法最近开始失效了。我们可以通过运行重现失败:
aws sts get-caller-identity
将 --debug
标志添加到最后一个命令:
09:11:47 2018-06-21 14:11:47,731 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.15.40 Python/2.7.12 Linux/4.9.76-3.78.amzn1.x86_64 botocore/1.10.40
...
09:11:47 2018-06-21 14:11:47,811 - MainThread - botocore.hooks - DEBUG - Event choose-signer.sts.GetCallerIdentity: calling handler <function set_operation_specific_signer at 0x7f22d19a6ed8>
09:11:47 2018-06-21 14:11:47,812 - MainThread - botocore.credentials - WARNING - Refreshing temporary credentials failed during mandatory refresh period.
09:11:47 Traceback (most recent call last):
09:11:47 File "/var/lib/jenkins/.local/lib/python2.7/site-packages/botocore/credentials.py", line 432, in _protected_refresh
...
09:11:47 raise KeyError(cache_key)
09:11:47 KeyError: 'xxxx' (redacted)
09:11:47 2018-06-21 14:11:47,814 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255
显然 Python“缓存”字典中缺少一个键。
最佳答案
显而易见的解决方案就是找到并删除缓存:
rm ~/.aws/cli/cache/*
不过,这并不能解释这是如何开始发生的(以及它是否会再次发生)。谁能解释一下发生了什么?
关于amazon-web-services - 无法通过 AWS 配置文件承担角色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50972405/
我在尝试使用 create-function 命令创建 lambda 函数时收到错误消息“Lambda 无法承担为函数定义的角色”。 aws lambda create-function --regi
我正在尝试使用代码放置 cloudwatch 事件规则: await cloudwatchevents.putRule({ Name: 'xxx-ec2-start', EventPatter
我有一个应用程序需要以不寻常的方式处理事件。 对于我的问题,我先说明一个简单的案例,Android目前的事件处理系统不适合我。 假设我有一个 FrameLayout(从现在起我将称之为 ViewSwi
我是一名优秀的程序员,十分优秀!