I am trying to upload a set of two .net core projects to my AWS elastic beanstalk environment using powershell.
Following the tutorial here I run a script to update the EB version, as below:
$applicationName = "PaveStateOnline"
$environmentName = "PaveStateOnline-prod6"
$versionLabel = [System.DateTime]::Now.Ticks.ToString()
New-EBApplicationVersion -ApplicationName $applicationName -VersionLabel $versionLabel -SourceBundle_S3Bucket $s3Bucket -SourceBundle_S3Key app-bundle.zip -Region "Asia Pacific (Sydney)"
However, this code gives the following exception:
New-EBApplicationVersion : Invalid URI: The hostname could not be parsed.
At C:\Users\jpn\Projects\FieldLogger\deploy.ps1:57 char:1
+ New-EBApplicationVersion -ApplicationName $applicationName -VersionLa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-EBApplicationVersion], UriFormatException
+ FullyQualifiedErrorId : System.UriFormatException,Amazon.PowerShell.Cmdlets.EB.NewEBApplicationVersionCmdlet
So it's saying here that there's an invalid URI. However, when I checked out another place which uses this method, and that doesn't even use a URI at all. Anyone have a clue on why this is crashing, or why it thinks that I should be passing a URI through?
The region parameter for that command defines the uri at least partially. The correct code for that region should be "ap-southeast-2". For anyone else there is a list of the codes on this page: https://docs.aws.amazon.com/general/latest/gr/rande.html
That would make your command:
New-EBApplicationVersion -ApplicationName $applicationName -VersionLabel $versionLabel -SourceBundle_S3Bucket $s3Bucket -SourceBundle_S3Key app-bundle.zip -Region "ap-southeast-2"