Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chedabob/36f9313cf69956de4ab5c4415b582ff3 to your computer and use it in GitHub Desktop.
Save chedabob/36f9313cf69956de4ab5c4415b582ff3 to your computer and use it in GitHub Desktop.
Import-Module AWSPowerShell
Set-AWSCredentials -ProfileName default -ProfilesLocation C:\aws-creds\<redacted>-live
Set-DefaultAWSRegion -Region eu-west-2
$s3Bucket = "<redacted>"
$filename = ($OctopusParameters['Octopus.Release.Number'] + ".zip")
Write-Host 'Write application bundle to S3'
# Determine S3 bucket to store application bundle
Write-S3Object -BucketName $s3Bucket -File $OctopusParameters['Octopus.Action[Package live for AWS].Output.PayloadPath'] -Key $filename
$applicationName = "<redacted>"
$environmentName = "live"
$versionLabel = $OctopusParameters['Octopus.Release.Number']
Write-Host 'Update Beanstalk environment for new application bundle'
New-EBApplicationVersion -ApplicationName $applicationName -VersionLabel $versionLabel -SourceBundle_S3Bucket $s3Bucket -SourceBundle_S3Key $filename
Update-EBEnvironment -ApplicationName $applicationName -EnvironmentName $environmentName -VersionLabel $versionLabel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment