我正在尝试创建一个 IAM 角色/策略,以使我的 EC2 实例能够列出和附加 EBS 卷(通过调用 cli 的脚本aws)。我希望此策略仅允许列出/附加具有特定标签的 EBS 卷。
Resources: "*"我注意到,当我在下面的策略中设置和否时,脚本能够列出/附加卷Conditions。但是当我引入下面的策略时,AWS cli 就会抛出以下错误:
./aws ec2 describe-volumes
An error occurred (UnauthorizedOperation) when calling the DescribeVolumes operation: You are not authorized to perform this operation.
Run Code Online (Sandbox Code Playgroud)
以下是我迄今为止在 terraform 中定义的 IAM 策略:
resource "aws_iam_role" "web_role" {
name = "web_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}
resource "aws_iam_instance_profile" "web_profile" …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Vue 构建一个搜索页面,并且我希望用户在输入字段中输入的查询文本能够与 URL 中的查询参数发生反应,例如:
输入:foo 网址: http://localhost:8080/search?query=foo
如果用户继续bar在输入字段中输入,我希望将 URL 更新为http://localhost:8080/search?query=foobar而无需通过路由器导航。