SCS-C02 免费试练题 · 考证匠讲解
题目
A company is testing its incident response plan for compromised credentials. The company runs a database on an Amazon EC2 instance and stores the sensitive database credentials as a secret in AWS Secrets Manager. The secret has rotation configured with an AWS Lambda function that uses the generic rotation function template. The EC2 instance and the Lambda function are deployed in the same private subnet. The VPC has a Secrets Manager VPC endpoint. A security engineer discovers that the secret cannot rotate. The security engineer determines that the VPC endpoint is working as intended. The Amazon CloudWatch logs contain the following error: "setSecret: Unable to log into database". Which solution will resolve this error?
答案
拆题
- 日志是 setSecret unable to log into database,失败点在 Lambda→数据库登录。
- 同 subnet 不会绕过 security groups;Lambda 出站与 EC2 入站要允许数据库端口。
- 网络通后还需检查当前 secret、数据库用户权限和引擎配置,不能把所有登录失败都归为 SG。
每个选项为什么对、为什么错
- A:修改 JSON 要依据真实格式错误,本题已指向数据库连接,不应任意改凭证字段。
- B(正确):Lambda SG 出站与 DB EC2 SG 入站按源 SG 放行数据库端口,是最直接待查链路。
- C:强制重试不会修复连通或认证问题,list-secrets 也不返回明文凭证。
- D:现有 Secrets Manager endpoint 已正常,NAT 去公共 endpoint 绕路不修复数据库登录。
放到具体场景里
教学例子:Lambda 访问 Secrets Manager 成功,但访问 EC2 MySQL 3306 超时。数据库 SG 添加来源 rotation-lambda-sg 的 3306 规则,Lambda 出站允许目标。若后来日志变成 access denied for user,再检查账号与 current/pending secret,不继续扩大网络范围。
| 检查对象 | 本例条件或动作 | 结果与边界 |
|---|---|---|
| 服务读取 | Secrets Manager vpce | 已验证正常 |
| 数据库连接 | Lambda→EC2:3306 | 双侧 SG |
| 认证 | current/pending secret | 网络通后另查 |
遇到同类题的判断顺序
- 定位阶段:区分 getSecret 与 setSecret。
- 测试连接:检查端口和 SG。
- 验证凭证:确认数据库账户权限。
- 完成轮换:检查 staging labels 与应用登录。
参考资料
继续练这门考试
同一门考试的免费试练题都附这样的完整讲解,做完再看讲解。
