'How to run `dotnet lambda deploy-serverless` command without parameters?
Good evening. The question is about dotnet lambda deploy-serverless
command. This command is used to deploy .Net apps to AWS Lambda service using AWS CloudFormation. When I try to run this command in Jenkins pipeline in stage:
stage('Update AWS lambda') {
steps {
bat "cd MyFinance.Api"
bat "dotnet lambda deploy-serverless"
}
}
I receive errors about missing parameters:
C:\Program Files (x86)\Jenkins\workspace\MyFinanceApiPipeline>dotnet lambda deploy-serverless Amazon Lambda Tools for .NET Core applications (4.1.0) 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 S3 Bucket: (S3 bucket to upload the build output) Enter CloudFormation Template: (Path to the CloudFormation template) Enter AWS Region: (The region to connect to AWS services, if not set region will be detected from the environment.) Can not determine AWS region. Either configure a default region or use the --region option.
But if I run this command via PowerShell in my project folder everything is ok. Near is a screenshot of command execution results. Successful command execution in PowerShell So, how to run this without parameters in Jenkins pipeline (like I made via PowerShell)? Thank you in advance.
Solution 1:[1]
This happens when you don't pass those requested parameters. You may pass these as arguments to the command
dotnet lambda deploy-serverless --stack-name replace-your-stack-name-here --s3-bucket replace-s3-bucket-name-here --region replace-with-region
You will have to navigate the folder where you have the "serverless.template" file before running this command. or optionally you can pass the path to the template file with the argument -t
Solution 2:[2]
If you are deploying from Azure DevOps and getting this error,
1. Error: The process '/home/vsts/.dotnet/tools/dotnet-lambda' failed with exit code 255
2. "Missing" required parameter: --template
Make sure to navigate to the folder where you have the "serverless.template" file on Path to Lambda Project $(System.DefaultWorkingDirectory)/Buildfolder/ArtifactsFolder/severless.template_folder
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 |