我遇到了一个问题。我们的想法是在AWS Redshift查询控制台中使用临时凭据将联邦(IDP) AWS用户名作为登录名传递给Redshift。但是用户应该只能连接到他的Redshift用户id。为了使用它,我们编写了这样一段代码。Redshift在用户之前就已经创建好了。
{
"Sid": "Sid",
"Effect": "Allow",
"Action": "redshift:GetClusterCredentials",
"Resource": [
"arn:aws:redshift:eu-west-1:account_number:dbuser:cluster_name/${aws:username}",
"arn:aws:redshift:eu-west-1:account_number:dbname:cluster_name/db_name"
]
}但是Redshift在用户id (useid = "user_test")中只使用小字母,而${aws:username}只返回大字母("USER_TEST")。在我们的示例中,我们不能更改${aws:username}中的值,因为它最终来自IDP服务。有没有可能使一个表达式以某种方式使其等于?
谢谢!伊万
发布于 2021-04-28 00:18:25
IAM条件下的StringEqualsIgnoreCase可以帮助您:
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "redshift:GetClusterCredentials",
"Resource": [
"arn:aws:redshift:eu-west-1:account_id:dbname:cluster_name/db_name",
"arn:aws:redshift:eu-west-1:account_id:dbuser:cluster_name/${redshift:DbUser}"
],
"Condition": {
"StringEqualsIgnoreCase": {
"aws:userid": "role_id:${redshift:DbUser}"
}
}
},https://stackoverflow.com/questions/67199876
复制相似问题