【以下的问题经过翻译处理】 我正在尝试从使用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
}
有什么线索我哪里出错了吗?