This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| curl -s 'https://api.regional-table.region-services.aws.a2z.com/index.json' \ | |
| | jq '.prices[] | .attributes | .["aws:region"], .["aws:serviceName"]' \ | |
| | sed '$!N;s/\n/,/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Specify contact list name here | |
| CONTACT_LIST_NAME='' | |
| OUTPUT_FILE="./contact-list_$CONTACT_LIST_NAME-$(date +%s).csv" | |
| AWS_CLI_COMMAND="aws sesv2 list-contacts --contact-list-name $CONTACT_LIST_NAME --filter FilteredStatus=OPT_IN --page-size 1000 " | |
| function cli_call() { | |
| if [ ! -z NEXT_TOKEN ]; then | |
| cli_output=$($AWS_CLI_COMMAND) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get a list of all SSM managed instances that appear to be online | |
| aws ssm describe-instance-information --filter Key=PingStatus,Values=Online --query "InstanceInformationList[*].{Instance:InstanceId,Name:Name}" --output=text | |
| # Get a list of all IPs for a service in region | |
| # Way 1: using prefix lists | |
| aws ec2 get-managed-prefix-list-entries --prefix-list-id pl-b8a742d1 | |
| # Way 2: using ip-ranges.json | |
| curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq '.prefixes | map(select(.region=="ap-southeast-2" and .service=="EC2")) | map(.ip_prefix) | .[]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo -e "Running custom Unifi userdata" | |
| AWS_DEFAULT_REGION=ap-southeast-2 | |
| # Assoicate an elastic IP | |
| ALLOC_ID=eipalloc-deadbeef | |
| # Set timezone | |
| ln -fs /usr/share/zoneinfo/Pacific/Auckland /etc/localtime | |
| apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Content-Type: multipart/mixed; boundary="//" | |
| MIME-Version: 1.0 | |
| --// | |
| Content-Type: text/cloud-config; charset="us-ascii" | |
| MIME-Version: 1.0 | |
| Content-Transfer-Encoding: 7bit | |
| Content-Disposition: attachment; filename="cloud-config.txt" | |
| #cloud-config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| brew install --cask visual-studio-code | |
| brew install --cask iterm2 | |
| brew install --cask alfred | |
| brew install --cask istat-menus | |
| brew install --cask hiddenbar | |
| # Shell | |
| echo 'alias l="ls -lashF"' >> ~/.zshrc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get -y install git zsh && echo zsh >> ~/.bashrc | |
| # Install oh-my-zsh | |
| sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended | |
| # Install powelevel10k | |
| git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k && | |
| sed -i 's/robbyrussell/powerlevel10k\/powerlevel10k/' ~/.zshrc && |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Associate this EIP on launch. | |
| ALLOC_ID=eipalloc-0d896138148fed55c | |
| AWS_DEFAULT_REGION=ap-southeast-2 | |
| echo "Updating packages..." | |
| # Force grub to update in a silent mode | |
| DEBIAN_FRONTEND=noninteractive apt-get -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" -qq --allow-remove-essential --allow-change-held-packages upgrade | |
| # Update packages. | |
| sudo apt-get upgrade -y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| schemaVersion: '2.2' | |
| description: State Manager Bootstrap Example | |
| parameters: {} | |
| mainSteps: | |
| - action: aws:runShellScript | |
| name: backupUnifi | |
| inputs: | |
| runCommand: | |
| - aws s3 --region ap-southeast-2 sync <your-folder> s3://<your-bucket> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Note for Cloudshell, only stuff in your home directory is saved. | |
| # But, Cloudshell already has git and zsh available. So we just install custom binaries to ~/bin and update our path. | |
| # you can whoami == cloudshell-user or $AWS_EXECUTION_ENV==CloudShell to detect cloudshell | |
| # Start zsh on startup. No chsh :( | |
| [[ $AWS_EXECUTION_ENV == "CloudShell" ]] && echo "In CloudShell, no need to install git/zsh" || sudo yum -y install git zsh && echo zsh >> ~/.bashrc | |
| # Install oh-my-zsh | |
| sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended |