Skip to content

Instantly share code, notes, and snippets.

@adenot
adenot / aws-export-cloudshell-creds.sh
Created October 15, 2025 08:31
Exports credentials from AWS CloudShell
aws configure export-credentials | jq -r '"export AWS_ACCESS_KEY_ID=\"" + .AccessKeyId + "\"\nexport AWS_SECRET_ACCESS_KEY=\"" + .SecretAccessKey + "\"\nexport AWS_SESSION_TOKEN=\"" + .SessionToken + "\"\n# Expires: " + .Expiration'
@adenot
adenot / assume-role.sh
Created September 18, 2025 23:34
usage: source assume-role.sh <arn>
#!/bin/bash
# Usage: source assume-role.sh <role-arn> <session-name>
ROLE_ARN=${1:?Role ARN required}
SESSION_NAME=${2:-"AssumeRoleSession"}
CREDS=$(aws sts assume-role \
--role-arn "$ROLE_ARN" \
--role-session-name "$SESSION_NAME" \
--query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]' \
#!/usr/bin/env python3
"""
Script to delete all default VPCs across all AWS regions.
Only targets VPCs that are marked as default.
"""
import boto3
from botocore.exceptions import ClientError
def get_all_regions():
@adenot
adenot / ssm-port-forward.sh
Created November 5, 2024 02:43
Port Forward using AWS SSM Session Manager to access private services like RDS
aws ssm start-session --target <instance-id> --document-name AWS-StartPortForwardingSessionToRemoteHost --parameters '{"portNumber":["3306"],"localPortNumber":["3306"],"host":["remote-database-host-name"]}'
@adenot
adenot / aws-regions-short.md
Created June 20, 2024 08:28
AWS Regions and Official Short Codes (from AWS Billing)
Region Short Code Region Name Region Long Code
ape1 Asia Pacific (Hong Kong) ap-east-1
apn1 Asia Pacific (Tokyo) ap-northeast-1
apn2 Asia Pacific (Seoul) ap-northeast-2
apn3 Asia Pacific (Osaka) ap-northeast-3
aps1 Asia Pacific (Singapore) ap-southeast-1
aps2 Asia Pacific (Sydney) ap-southeast-2
aps3 Asia Pacific (Mumbai) ap-south-1
aps4 Asia Pacific (Jakarta) ap-southeast-3
@adenot
adenot / ownvpn-privacy-policy.md
Last active June 16, 2024 06:10
ownVPN Privacy Policy - https://ownvpn.app
  1. Introduction: Welcome to ownVPN, where your privacy is not just a feature—it’s the foundation of everything we do. This Privacy Policy underscores our commitment to safeguarding your personal information and clarifies our practices regarding the collection, use, and disclosure of your data when using our app.

  2. No Data Collection:

  • Direct Cloud Provider Interaction: ownVPN is designed to operate without collecting any personal information from you. The app interfaces directly with your chosen cloud provider, and all configuration data remains between you and your cloud provider.
  • No Company Communication: The ownVPN app does not communicate any data back to us. We do not receive, store, or analyze any data related to your use of ownVPN.
  1. Information Sharing and Disclosure: Since we do not collect any personal information, there is nothing to share or disclose to third parties. We are committed to ensuring your privacy and keeping your personal data confidential.
@adenot
adenot / ssm-loader.sh
Last active April 19, 2022 22:11
Using SSM Loader (AWS CloudShell)
pip3 install ssm-loader
./.local/bin/ssm dump /app/dev/ -o app-dev.json
# edit app-dev.json, and load back:
./.local/bin/ssm load -f app-dev.json
@adenot
adenot / describe-workspace-bundles.sh
Created August 4, 2021 09:59
AWS Workspaces Bundles (aws workspaces describe-workspace-bundles)
bash-5.1# aws workspaces describe-workspace-bundles --owner AMAZON | jq -r '.Bundles[] | "\(.BundleId),\(.ComputeType.Name),\(.Description)"'
wsb-b0s22j3d7,PERFORMANCE,Windows 7 Experience provided by Windows Server 2008 R2 with PCoIP 2 vCPU 7.5GiB Memory 100GB Storage
wsb-clj85qzj1,STANDARD,Amazon Linux 2 with PCoIP 2 vCPU 4GiB Memory 50GB Storage
wsb-gm4d5tx2v,PERFORMANCE,Windows 10 Experience provided by Windows Server 2016 with PCoIP 2 vCPU 7.5GiB Memory 100GB Storage
wsb-1pzkp0bx4,POWERPRO,Windows 7 Experience provided by Windows Server 2008 with PCoIP 8 vCPU 32GiB Memory 100GB Storage
wsb-2bs6k5lgn,POWER,Amazon Linux 2 with PCoIP 4 vCPU 16GiB Memory 100GB Storage
wsb-6cdbk8901,PERFORMANCE,Windows 10 Experience provided by Windows Server 2016 with Office 2016 and PCoIP 2 vCPU 7.5GiB Memory 100GB Storage
wsb-bh8rsxt14,VALUE,Windows 10 Experience provided by Windows Server 2016 with PCoIP 1 vCPU 2GiB Memory 10GB Storage
wsb-92tn3b7gx,VALUE,Windows 7 Experience provided by Windows Server 2008 R2 with PCoIP
@adenot
adenot / install-kubectl-cloudshell.sh
Last active March 4, 2024 19:15
Install kubectl on aws cloudshell
curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.19.6/2021-01-05/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv kubectl /usr/local/bin/kubectl
@adenot
adenot / install-docker.md
Created July 25, 2021 01:00 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start