Skip to content

Instantly share code, notes, and snippets.

View allenmichael's full-sized avatar

Allen-Michael Grobelny allenmichael

  • Amazon Web Services
  • Austin, TX
  • X @amsxbg
View GitHub Profile
Import-Module AWSPowerShell.NetCore
$fileOrHost = Read-Host "Read from terminal[1] or file[2] (1 or 2)?"
if ("1", "2" -notcontains $fileOrHost ) {
$fileOrHost = "1"
}
$text = ""
if ($fileOrHost -eq "1") {
$text = Read-Host "Enter text to be redacted."
{
"data": "1,2018-03-01 00:01:34,2018-03-01 00:01:43,1,.00,1,N,145,145,2,2.5,0.5,0.5,0,0,0.3,3.8"
}
module.exports.handler = async (event) => {
console.log(JSON.stringify(event, 2));
return "Echoing your message: " + event.echo;
};
module.exports.handler = async (event) => {
console.log(JSON.stringify(event, 2));
return {
statusCode: 200,
body: "Echoing your message: " + event.echo
}
};
@allenmichael
allenmichael / template.yaml
Created February 18, 2019 23:14
Local Library Lambda Layer Template
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: Local Library Lambda Layer
Resources:
PetuniaDep:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: petunia-lib
Description: A bundled local library
Import-Module AWSLambdaPSCore
Import-Module AWSPowerShell.NetCore
$region = 'eu-west-2'
New-AWSPowerShellLambdaPackage -ScriptPath ./rek/DetectLabels.ps1 -OutputPackage DetectLabels.zip
Write-S3Object -BucketName amsxbg-dotnet-eu -File ./DetectLabels.zip
New-CFNStack -StackName DetectLabelsPS -Capabilities @("CAPABILITY_IAM","CAPABILITY_AUTO_EXPAND") -TemplateBody $(Get-Content ./serverless.template.json | Out-String) -Region $region
Wait-CFNStack -StackName DetectLabelPS
Get-CFNStack -StackName DetectLabelsPS -Region $region | Select-Object -ExpandProperty Outputs | Select-Object -Property @{Name='BucketName'; Expression={$_.OutputValue}} | Write-S3Object -File /Users/amsg/Documents/laser.jpg
Get-CFNStack -StackName DetectLabelsPS -Region $region | Select-Object -ExpandProperty Outputs | Select-Object -Property @{Name='BucketName'; Expression={$_.OutputValue}} | Get-S3ObjectTagSet -Key laser.jpg
#!/usr/bin/env bash
if [ -z "$1" ]
then
read -p "Please enter text: " TEXT
else
TEXT=$1
fi
if [ -z "$2" ]
then
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: >
devNull
/dev/null as a Service
Parameters:
KMSAliasName:
Type: String
Default: alias/devnull/share
aws secretsmanager create-secret --name box_config --secre
t-string $(base64 -i ./boxConfig.json)
@allenmichael
allenmichael / app_users_with_no_files.ps1
Last active March 28, 2018 20:07
A PowerShell script to list all App Users that currently have 0 GB allocated.
box users list | ConvertFrom-Json | select -ExpandProperty "Entries" | select Name,Login,Id,Space_Used | where {($_.Login -Match "AppUser" -and $_.Space_Used -eq 0)} | select Id,Name,Space_Used | Tee-Object -Variable box_users | select Id | ConvertTo-Json;
$box_users | Format-Table