【发布时间】:2022-12-03 07:52:30
【问题描述】:
我正在尝试从使用 C# 开发的 Lambda 访问系统参数
我已经按照https://docs.aws.amazon.com/systems-manager/latest/userguide/ps-integration-lambda-extensions.html#ps-integration-lambda-extensions-sample-commands 添加了所需的 lambda 层
lambda 执行角色在 IAM 定义中有以下内容(???????? 替换实际帐户 id)
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ssm:*"
],
"Resource": "arn:aws:ssm:*:???????????:parameter/*"
}
]
}
根据上面的 AWS 页面参考,我向 http://localhost:2773/systemsmanager/parameters/get/?name=/ClinMod/SyncfusionKey&version=1 发出了 HTTP GET 请求
以下响应失败
{
"Version": "1.1",
"Content": {
"Headers": [
{
"Key": "Content-Type",
"Value": [
"text/plain"
]
},
{
"Key": "Content-Length",
"Value": [
"31"
]
}
]
},
"StatusCode": 401,
"ReasonPhrase": "Unauthorized",
"Headers": [
{
"Key": "X-Amzn-Errortype",
"Value": [
"AccessDeniedException"
]
},
{
"Key": "Date",
"Value": [
"Thu, 01 Dec 2022 12:16:59 GMT"
]
}
],
"TrailingHeaders": [],
"RequestMessage": {
"Version": "1.1",
"VersionPolicy": 0,
"Content": null,
"Method": {
"Method": "GET"
},
"RequestUri": "http://localhost:2773/systemsmanager/parameters/get/?name=/ClinMod/SyncfusionKey&version=1",
"Headers": [],
"Properties": {},
"Options": {}
},
"IsSuccessStatusCode": false
}
我哪里出错的任何线索?
【问题讨论】:
-
您的秘密是否使用 KMS 加密?
-
您的保单看起来不错。考虑从您的 Lambda 进行临时 SDK
GetParameter调用以确保 100%。考虑对参数名称中的/进行 html 编码。在您的 Lambda 日志中寻找更多线索,扩展程序会在其中记录有用的信息。
标签: aws-lambda amazon-iam aws-lambda-layers