NodeJS [Errno 13] 权限被拒绝 - Azure DevOps 管道 AWS Lambda 部署

问题描述 投票:0回答:1

我正在使用此AWS 文档为 NodeJS 无服务器到 AWS Lambda 部署设置 Azure 管道。在部署过程中,出现“[Errno 13] Permission returned”错误:

当我检查日志文件时,错误消息是:

2024-03-28T10:11:10.4825015Z 
##[debug]Failed collecting file(s) due to error:
[('/run/cloud-init/combined-cloud-config.json', 
'/tmp/tmpze59c06e/cloud-init-logs-2024-03-28/run/cloud-init/combined-cloud-config.json', 
"[Errno 13] Permission denied: '/run/cloud-init/combined-cloud-config.json'"),
 ('/run/cloud-init/network-config.json', 
'/tmp/tmpze59c06e/cloud-init-logs-2024-03-28/run/cloud-init/network-config.json', 
"[Errno 13] Permission denied: '/run/cloud-init/network-config.json'")]

Yaml 代码在这里:

trigger:
- Branch Name

pool:
  vmImage: ubuntu-latest

steps:
- task: LambdaDeployFunction@1
  inputs:
    awsCredentials: 'Credential Name'
    regionName: 'region'
    deploymentMode: 'codeonly'
    functionName: 'function name here'
    codeLocation: 'localfile'

- script: |
    npm install
    npm install -g serverless
    serverless config credentials --provider aws --key DummyKeyHere --secret DummySecretKey
    serverless deploy --stage local --region eu-west-1
    
  displayName: 'Deploy to AWS'

不确定缺少什么权限。

node.js aws-lambda azure-devops azure-pipelines cicd
1个回答
0
投票

任务

LambdaDeployFunction@1
使用 AWS 服务连接连接到目标 AWS 云服务。 AWS 服务连接根据 AWS IAM 用户的
Access Key ID
Secret Access Key
进行身份验证,以便它可以继承授予 IAM 用户的权限。

对于一般 AWS 函数应用程序部署目的,请检查引用的 AWS 服务连接的底层 IAM 用户是否具有如下权限。

- task: LambdaDeployFunction@1
  inputs:
    awsCredentials: 'AWSSvcCnn'
    regionName: '$(AWSRegion)'
    deploymentMode: 'codeonly'
    functionName: 'arn:aws:lambda:$(AWSRegion):$(AWSAccountId):function:$(AWSLambdaFunction)'
    codeLocation: 'localfile'
    localZipFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'

© www.soinside.com 2019 - 2024. All rights reserved.