How to deploy Lambda->AWS using Github Action?

0

Hello everybody, Internet is large but I really could not find an answer.

I am developing AWS Lambda (NET6) and now I am trying to create a Github Action to build and deploy my function to AWS. Manually I do it but now want to automate.

Here is my yml file

name: .NET->AWS on: push: branches: [ main ] pull_request: branches: [ main ] workflow_dispatch:

jobs: build:

runs-on: ubuntu-latest
env:
  AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }}
  AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }}
  AWS_REGION: eu-west-2
steps:
- uses: actions/checkout@v3
- name: Setup .NET
  uses: actions/setup-dotnet@v3
- name: AWS CLI
  run: dotnet tool install -g Amazon.Lambda.Tools
- name: Build
  run: dotnet build -c release
- name: Deploy to Lambda
  run: dotnet lambda deploy-serverless

The project was built ok. The result of the Action is:

Deploy to Lambda

Run dotnet lambda deploy-serverless dotnet lambda deploy-serverless shell: /usr/bin/bash -e {0} env: AWS_ACCESS_KEY_ID: *** AWS_SECRET_ACCESS_KEY: *** AWS_REGION: eu-west-2 Amazon Lambda Tools for .NET Core applications (5.7.2) Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet Enter CloudFormation Stack Name: (CloudFormation stack name for an AWS Serverless application) Enter CloudFormation Template: (Path to the CloudFormation template) Enter S3 Bucket: (S3 bucket to upload the build output) Warning: Unable to determine region for bucket , assuming bucket is in correct region: BucketName is a required property and must be set before making this call. (Parameter 'GetBucketLocationRequest.BucketName') Unknown error executing command: Value cannot be null. (Parameter 'path2') at System.IO.Path.Combine(String path1, String path2) at Amazon.Lambda.Tools.Commands.DeployServerlessCommand.PerformActionAsync() in C:\build\src\Amazon.Lambda.Tools\Commands\DeployServerlessCommand.cs:line 145 at Amazon.Common.DotNetCli.Tools.Commands.BaseCommand`1.ExecuteAsync() in C:\build\src\Amazon.Common.DotNetCli.Tools\Commands\BaseCommand.cs:line 49 Error: Process completed with exit code 255.

What can be the reason?

Oleg
gefragt vor 10 Monaten550 Aufrufe
1 Antwort
0
profile picture
EXPERTE
beantwortet vor 10 Monaten
profile pictureAWS
EXPERTE
überprüft vor 10 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen