Skip to content

Instantly share code, notes, and snippets.

@kagarlickij
Last active February 24, 2017 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kagarlickij/1357ae63c02ca9f3ef2fcd3fb5faab6a to your computer and use it in GitHub Desktop.
Save kagarlickij/1357ae63c02ca9f3ef2fcd3fb5faab6a to your computer and use it in GitHub Desktop.
This one is to upgrade CloudWatch Metrics and Alarms
Write-Output "Setting Ec2ConfigService config.."
$tmp = "C:\Ec2ConfigServiceConfig"
git clone https://gist.github.com/3b9f9e511c2a37d6d5728a746e17aff8.git $tmp
Move-Item -Path $tmp\config.xml -Destination "C:\Program Files\Amazon\Ec2ConfigService\Settings\config.xml" -Force
Remove-Item $tmp -Recurse -Force
Write-Output "Setting CloudWatch config.."
$tmp = "C:\CloudWatchConfig"
git clone https://gist.github.com/e60a0eb733edf0846b338293c5a8b587.git $tmp
Move-Item -Path $tmp\AWS.EC2.Windows.CloudWatch.json -Destination "C:\Program Files\Amazon\Ec2ConfigService\Settings\AWS.EC2.Windows.CloudWatch.json" -Force
Remove-Item $tmp -Recurse -Force
Write-Output "Restarting AWS services.."
Restart-Service -Name Ec2Config
Restart-Service -Name AmazonSSMAgent
<#
Write-Output "Clonning set-CloudWatchAlarms script.."
$tmp = "C:\CloudWatchAlarms"
git clone https://gist.github.com/c7637457254f8b2da4c50c59b688bbf0.git $tmp
Move-Item -Path $tmp\set-CloudWatchAlarms.ps1 -Destination "C:\scripts\CloudWatch\set-CloudWatchAlarms.ps1" -Force
Remove-Item $tmp -Recurse -Force
Write-Output "Wait 10min for Metrics to be created before creating Alarms.."
Start-Sleep 600
Write-Output "Setting CloudWatch Alarms.."
Invoke-Expression "C:\scripts\CloudWatch\set-CloudWatchAlarms.ps1"
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment