Skip to content

Instantly share code, notes, and snippets.

View rowanu's full-sized avatar

rowan rowanu

View GitHub Profile

Preface:

It is, unfortunately, extremely common for customers and enterprises operating in AWS to have chosen a workload/storage bearing account (more than likely, the main production account) as the Organization Management Account (formerly known Organization "Master" account, before AWS adopted better naming).
Many customers and companies operating in AWS made this decision in 2018 or so and its unforunately not something that can be easily changed as of 2024. Many customers have requests to AWS to make a friendly path for rehoming the Org Management account, but last I heard it is still not prioritized. Thus, we as customers are left to go through the nerve-wracking, if not dangerous process of migrating to a new AWS Organization in order to align with modern best practices and reduce common privilege escalation and account to account lateral movement concerns (made worse if you happen to have enabled things like Cloudformation Stacksets, Control Tower, or other powerful services in the same

@ustayready
ustayready / gpt.py
Created January 16, 2023 23:49
CloudGPT - Use ChatGPT to analyze AWS policies for vulnerabilities
import openai
import boto3
import json
import time
from typing import Dict, List
openai.api_key = '### SET YOUR OPENAPI API KEY HERE ###'
session = boto3.session.Session()
client = session.client('iam')
@kapilt
kapilt / arn_db.json
Last active February 28, 2023 00:29
all aws resource arns
{
"a4b": {
"profile": "arn:{Partition}:a4b:{Region}:{Account}:profile/{Resource_id}",
"room": "arn:{Partition}:a4b:{Region}:{Account}:room/{Resource_id}",
"device": "arn:{Partition}:a4b:{Region}:{Account}:device/{Resource_id}",
"skillgroup": "arn:{Partition}:a4b:{Region}:{Account}:skill-group/{Resource_id}",
"user": "arn:{Partition}:a4b:{Region}:{Account}:user/{Resource_id}",
"addressbook": "arn:{Partition}:a4b:{Region}:{Account}:address-book/{Resource_id}",
"conferenceprovider": "arn:{Partition}:a4b:{Region}:{Account}:conference-provider/{Resource_id}",
"contact": "arn:{Partition}:a4b:{Region}:{Account}:contact/{Resource_id}",
@Linch1
Linch1 / tokenPriceApi.js
Last active April 20, 2025 18:46
Retrive the price of any bsc token from it's address without using external service like poocoin/dextools
let pancakeSwapAbi = [
{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},
];
let tokenAbi = [
{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},
];
const Web3 = require('web3');
/*
Required Node.js
@iann0036
iann0036 / gist:b473bbb3097c5f4c656ed3d07b4d2222
Last active January 28, 2025 16:24
List of expensive / long-term effect AWS IAM actions
route53domains:RegisterDomain
route53domains:RenewDomain
route53domains:TransferDomain
ec2:ModifyReservedInstances
ec2:PurchaseHostReservation
ec2:PurchaseReservedInstancesOffering
ec2:PurchaseScheduledInstances
rds:PurchaseReservedDBInstancesOffering
dynamodb:PurchaseReservedCapacityOfferings
s3:PutObjectRetention
#!/bin/bash
# This is a script that unsubscribes an email address from AWS junk mail.
# If the script breaks it might be the magic numbers that needs to change.
# Send the form while tracing the request in your browser to find the new values.
# https://pages.awscloud.com/communication-preferences
unsubscribe_aws_email() {
curl "https://pages.awscloud.com/index.php/leadCapture/save2" \
-H "Accept: application/json" \
@wolfeidau
wolfeidau / cognito.yml
Last active January 28, 2020 04:22
Cognito CFN stack with domain verification
AWSTemplateFormatVersion: 2010-09-09
Description: 'authentication: Resources for hosting authentication using AWS Cognito, a @wolfeidau template'
Parameters:
AppName:
Description: Name of application, used in signup emails and naming of aws resources.
Type: String
AllowedPattern: '^[a-zA-Z0-9]*$'
@wolfeidau
wolfeidau / sam.md
Created May 9, 2018 16:57
Install sam from scratch on osx with homebrew.

To setup sam local on an OSX system which is using homebrew.

Check if pip installed.

pip --version

If this returns.

@stevenringo
stevenringo / reinvent-2017-youtube.md
Created December 3, 2017 23:01
Links to YouTube recordings of AWS re:Invent 2017 sessions

| Title | Description