I am trying to deploy a ASP.NET Web API to AWS Beanstalk using AWS CodePipeline with both buid and deploy stage and source code is on Github. Now my build stage seems to be working with a success message but the deploy stage is failing with the error:
Deployment completed, but with errors: During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version. Failed to deploy application. Unsuccessful command execution on instance id(s) 'i-0aa02c41a8683f9a7'. Aborting the operation. [Instance: i-0aa02c41a8683f9a7 ConfigSet: Infra-WriteRuntimeConfig, Infra-EmbeddedPreBuild, Hook-PreAppDeploy, Infra-EmbeddedPostBuild, Hook-EnactAppDeploy, Hook-PostAppDeploy] Command failed on instance. Return code: 1 Output: null. Error occurred during build: Command hooks failed Deployment Failed: Unexpected Exception
I am not able to understand what the problem is, am I making a mistake in the buildspec.yml file is it something else. This my buildspec file for reference:
version: 0.2
phases:
install:
runtime-versions:
dotnet: 8.0
commands:
- echo "Installing .NET Core 8.0"
pre_build:
commands:
- echo "Restoring .NET packages"
- dotnet restore IndiaShoppingBackend.sln || exit 1
build:
commands:
- echo "Building the .NET application"
- dotnet build IndiaShoppingBackend.sln --configuration Release || exit 1
- echo "Publishing the .NET application"
- dotnet publish IndiaShoppingBackend/IndiaShoppingBackend.csproj --configuration Release --output ./output || exit 1
post_build:
commands:
- echo "Zipping the output files"
- zip -r output.zip ./output || exit 1
- echo "Copying files to S3"
- aws s3 cp output.zip s3://indiashoppingbackend-artifacts-bucket/output.zip || exit 1
artifacts:
files:
- output/**
discard-paths: yes
FYI, I am using RDS for databse hosting and I tested it locally and its working just fine.
Can anyone help me with this? Thanks in advance.
I was trying to deploy backend webapi to aws beanstalk using codepipeline for ci/cd deployment.
the build stage worked but deployment failed
Shail Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.