aws ec2元数据冒名顶替服务
imposter的Python项目详细描述
创建此服务是为了使用 在您的开发环境中担任角色。
安装
pip install imposter
用法
启动服务
imposter --profile <AWS CLI profile name> [--bind[host]:port](169.254.169.254:80)[-D] (daemonize)
如果服务检测到您没有专用IP地址 169.254.169.254,它将尝试用sudo为您创建它。会的 同时请求凭据,以便可以在特权服务器上运行服务 港口。
停止服务
imposter --stop
列出角色
imposter --roles
转换角色
imposter --profile <AWS CLI profile name>
如果服务正在运行,它将尝试切换活动角色。如果 不会,它会发射的。转换角色相当于运行
curl -XPOSThttp://169.254.169.254/roles/<profilename>
检查服务状态
imposter --status
您的aws cli配置
您的aws cli配置应该not在^{tt8}中具有凭据$ profile,否则aws sdk将在那里查找 正在查找EC2元数据服务。相反,让你的配置文件 用您的凭据指向一个单独的非默认部分,例如
[profile teamrole1] role_arn = arn:aws:iam::123456789012:role/teamrole1 source_profile = myidentity role_session_name = teamrole1 [profile teamrole2] role_arn = arn:aws:iam::123456789012:role/teamrole2 source_profile = myidentity role_session_name = teamrole2 [myidentity] aws_access_key_id = ABCDEFGHIJKLMNOPQRST aws_secret_access_key = abcdefghij1234567890abcdefghij1234567890