在不使用“source_profile”的情况下在EC2主机上切换IAMangular色
我有一个EC2 Ubuntu主机,我有一个用户帐户,负责在不同的时间运行不同的任务。 每个任务都需要由相应的IAMangular色表示的特定权限(我称之为“个人档案angular色”)。 这个想法是授予这个用户在需要时承担这些angular色的权限。 现在, ~/.aws/credentialsconfiguration如下所示: [default] aws_access_key_id = XXX aws_secret_access_key = YYY [profile1] role_arn = arn:aws:iam::XXXXXXXXXX:role/role-for-profile1 source_profile = default [profile2] role_arn = arn:aws:iam::XXXXXXXXXX:role/role-for-profile2 source_profile = default … [profileN] role_arn = arn:aws:iam::XXXXXXXXXX:role/role-for-profileN source_profile = default defaultconfiguration文件中的用户具有一个权限:承担以role-for-profile开始的任何angular色。 JSON策略如下所示: { "Version": "2012-10-17", "Statement": [ { "Sid": "Stmt1494333413000", "Effect": "Allow", "Action": [ "sts:AssumeRole" ], "Resource": [ "arn:aws:iam::XXXXXXXXXX:role/role-for-profile*" ] […]