amazon-web-services - 根据条件键创建 RDS 实例时出错
问题描述
我将以下 scp 策略附加到我的帐户,以阻止创建没有项目标签的 rds 实例。
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyCreateDBInstanceNoProjectTag",
"Effect": "Deny",
"Action": "rds:CreateDBInstance",
"Resource": "arn:aws:rds:*:*:db:*",
"Condition": {
"Null": {
"aws:RequestTag/Project": "true"
}
}
}
]
}
但是,当我使用 Project 标签创建 RDS 实例时,我收到拒绝访问错误,找不到匹配项:[Key=Project]。
aws rds create-db-instance \
--allocated-storage 20 --db-instance-class db.m1.small \
--db-instance-identifier mydbinstance \
--engine mysql \
--enable-cloudwatch-logs-exports '["audit","error","general","slowquery"]' \
--master-username ***** \
--master-user-password *****
--tags [{"Key"="Project","Value"="test"}]
An error occurred (AccessDenied) when calling the CreateDBInstance operation: User: arn:aws:sts::*********:assumed-role/*****/****** is not authorized to perform: rds:CreateDBInstance on resource: arn:aws:rds:******:*********:db:mydbinstance with an explicit deny
exit status 254
zsh: no matches found: [Key=Project]
解决方案
在 JSON 格式中,将 Keys 指定为:
--tags [{"Key":"Project", "Value":"test"}]
推荐阅读
- django - Django:自定义登录后重定向到同一页面
- git - 订单项的 Github 历史记录
- google-cloud-platform - Terraform 状态文件锁定 GCP 数据存储和 GCS 后端示例
- python - 为什么我的回复是循环而不是整个程序
- python-3.x - DRF 序列化程序未在默认 HTML 表单页面 API 中显示字段(外键和 many2many)。字段在 GET 中可用
- java - 在可选列表中查找字符串
- powershell - Are you able to use PtrToStringAuto to decrypt a secure string in Powershell 7 on macOS?
- delphi - 如何使 ListBox 项具有给定的颜色?
- java - Javac 不是内部或外部命令
- ruby - 使用 Ruby 和 Psych 解析 Unity YAML 场景文件的语法错误