After a lot of research and attempted fixes, I discovered that the fix was to provide a manifest to AWS.
aws-windows-deployment-manifest.json
{
"manifestVersion": 1,
"deployments": {
"msDeploy": [
{
"name": "service",
"parameters": {
"appBundle": "CSI.Service.zip",
"iisPath": "/"
}
}
]
}
}
This file must be placed within a zip hierarchy as follows:
- Zip to Upload
- aws-windows-deployment-manifest.json
- CSI.Service.zip (application deployment zip file from build)
Edit: Add details about pipelines to build/deploy
For my deployment process, I use a Build Pipeline to package the project up into the zip files (multiple for some projects that use multiple instances of elastic beanstalk). After that, I run a Release Pipeline to deploy the change to Elastic Beanstalk
Build Pipeline
In the build pipeline, I basically build the solution, which packages the Web API into a zip file, copy the zip file and AWS manifest file to a folder together, and then zip them up into the build drop zone. It is also important to note that the name of the manifest file is important, as it must match what Amazon expects it to be. Otherwise, it will be ignored. It is also important to make sure you set the Archive task to not prepend the root folder name to the archive paths.
steps:
- task: VSBuild@1
displayName: 'Build solution **\*.sln $(BuildConfiguration)'
inputs:
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
clean: true
steps:
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)\eb-deploy\'
inputs:
SourceFolder: '$(Build.SourcesDirectory)\CSI.Service'
Contents: 'aws-windows-deployment-manifest.json'
TargetFolder: '$(Build.ArtifactStagingDirectory)\eb-deploy\'
steps:
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)\eb-deploy\'
inputs:
SourceFolder: '$(Build.ArtifactStagingDirectory)'
Contents: CSI.Service.zip
TargetFolder: '$(Build.ArtifactStagingDirectory)\eb-deploy\'
steps:
- task: ArchiveFiles@2
displayName: 'Archive $(Build.ArtifactStagingDirectory)\eb-deploy\'
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\eb-deploy\'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)/drop/Service/eb-deploy-service-$(shared.environmentExtension).zip'
Release Pipeline
The release pipeline simply takes the created zip file from the build and pushes it up to the corresponding AWS Elastic Beanstalk application/environment.
steps:
- task: AmazonWebServices.aws-vsts-tools.BeanstalkDeployApplication.BeanstalkDeployApplication@1
displayName: 'Deploy to Elastic Beanstalk: $(service.environmentName)$(shared.environmentExtension)'
inputs:
awsCredentials: 'My AWS'
regionName: 'us-east-1'
applicationName: '$(service.applicationName)'
environmentName: '$(service.environmentName)$(shared.environmentExtension)'
webDeploymentArchive: '$(System.DefaultWorkingDirectory)\_CSI Build\drop\Service\eb-deploy-service-$(shared.environmentExtension).zip'