Skip to content

Instantly share code, notes, and snippets.

{"instanceId":"$.detail.configuration.metrics[0].metricStat.metric.dimensions.InstanceId"}
#!/bin/bash
mkdir -p /media/data/images
for i in {00001..0020000}; do
aws s3 cp s3://aft-vbi-pds/bin-images/$i.jpg /media/data/images/ >> /tmp/sync
done
aws s3 cp s3://ee-assets-prod-us-east-1/modules/e35bbbac194e4808b01d7bb937cadfa9/v1/db_backup/sample_backup_20210322.bak /media/data/MSSQL_BACKUP/ >> /tmp/sync
echo "/media/data *(rw,no_root_squash)" > /tmp/exports
sudo cp /tmp/exports /etc/exports
sudo service nfs restart
AWSTemplateFormatVersion: '2010-09-09'
Description: Base stack to create container day resources
Parameters:
# EKS Parameters
Cloud9IDEInstanceType:
Description: The type of instance to connect to the environment
Type: String
Default: t3.large
@ejschaefer
ejschaefer / AzureHybridBenefitHelpers.ps1
Created May 7, 2020 15:35
Get or Set Azure Hybrid Benefit Licenses
function Get-VMLicensesByLocation($location)
{
$vms = Get-AzVM -Location $location
$vm_sizes = Get-AzVMSize -Location $location
Write-Output "VM Name, ResourceGroupName,Location,VMSize,NumCores,LicenseType"
foreach ($vm in $vms)
@ejschaefer
ejschaefer / Get-BackupConfig.ps1
Created April 19, 2018 16:04
List Azure VM Backups
#Get All Recovery Services Vaults
$vaults = Get-AzureRMRecoveryServicesVault
#Loop through all RS Vaults and output details for each container (VM)
foreach ($vault in $vaults)
{
Set-AzureRmRecoveryServicesVaultContext -Vault $vault
$containers = Get-AzureRmRecoveryServicesBackupContainer -ContainerType "AzureVM"
foreach ($container in $containers)
# Purpose: DRY RUN -- any enviornment. This script will prepare then abort a migration.
# Very useful script to dry run test an actual vnet that is planned for migration. No disconnection from ER or VPN is required. Simply prepare and abort a migration to flush out issues, as discussed above.
#
# Assumption 1: Logged into Azure with Add-AzureAccount
#
#
Param
(
@ejschaefer
ejschaefer / Remove-BGInfo.ps1
Created April 12, 2018 21:29
Remove Extensions from Azure Classic VMs
<#
# Inspired by https://github.com/Azure/classic-iaas-resourcemanager-migration/blob/master/AsmToArmMigrationApiToolset/Scripts/OtherScripts/RemoveExtensions.ps1
#
# Licensed under the MIT License.
#
#>
$global:ScriptStartTime = (Get-Date -Format hh-mm-ss.ff)
if((Test-Path "Output") -eq $false)
@ejschaefer
ejschaefer / Prune-vCenter.sql
Created December 26, 2017 17:55
Slowly Prune vCenter MSSQL Database
--Define the default data retention time (number of days)
DECLARE @default_retention INT;
SET @default_retention = 180;
--Enable task & event pruning
UPDATE dbo.VPX_PARAMETER set dbo.VPX_PARAMETER.VALUE = 'true' where dbo.VPX_PARAMETER.NAME in ('event.maxAgeEnabled', 'task.maxAgeEnabled');
DECLARE @record_age INT;
--Get the oldest event date (days since today)
SET @record_age = (SELECT TOP 1 CAST(DATEDIFF(DAY, CREATE_TIME, CURRENT_TIMESTAMP) as INT) from VPX_EVENT ORDER BY CREATE_TIME ASC);

Keybase proof

I hereby claim:

  • I am ejschaefer on github.
  • I am ejschaefer (https://keybase.io/ejschaefer) on keybase.
  • I have a public key ASB9ej-_vTo2ZdH9AMiMqaqIcCC1PpWBXzGy5eHmgpQs0Qo

To claim this, I am signing this object: