Skip to content

Instantly share code, notes, and snippets.

View austoonz's full-sized avatar

Andrew Pearce austoonz

View GitHub Profile
@austoonz
austoonz / Write-SSMComplianceItemExample
Last active April 5, 2019 22:31
Sample code for writing an AWS Systems Manager Compliance Item.
$managedInstanceId = (Get-Content -Path 'C:\ProgramData\Amazon\SSM\InstanceData\Vault\Store\RegistrationKey' -Raw | ConvertFrom-Json).instanceID
$moduleNames = @(
'AWSPowerShell',
'ClipboardText',
'Convert',
'PSWindowsUpdate'
)
$complianceItems = [System.Collections.Generic.List[Amazon.SimpleSystemsManagement.Model.ComplianceItemEntry]]::new()
foreach ($moduleName in $moduleNames)
brew cask install quicklook-json
(Get-Item -Path 'HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters').GetValue('HostName')
@austoonz
austoonz / Lambda-SQS-Trigger
Last active January 15, 2019 03:38
A CloudFormation template sample to subscribe an AWS Lambda Function to an SQS Queue.
---
AWSTemplateFormatVersion: '2010-09-09'
Description: SQS Queue with Lambda Trigger
Parameters:
LambdaS3BucketName:
Type: String
Description: S3 Bucket Name holding the Lambda Function Package
@austoonz
austoonz / PowerShellAssociation.yml
Last active January 3, 2025 04:27
CloudFormation Templates
---
AWSTemplateFormatVersion: '2010-09-09'
Description: Creates a Systems Manager Association with inline PowerShell.
Resources:
Association:
Type: AWS::SSM::Association
Properties:
AssociationName: AssociationName
Name: AWS-RunPowerShellScript
Parameters:
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', '')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '')]