curl -Ls https://gist.githubusercontent.com/atheiman/45e45ada59e558b21f951d8e81faf345/raw/cloudshell-setup.sh?$RANDOM | bash
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
terraform { | |
required_providers { | |
aws = { | |
source = "hashicorp/aws" | |
version = ">= 5.0" | |
} | |
} | |
} | |
resource "aws_config_organization_custom_policy_rule" "required_tags" { |
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
terraform { | |
required_providers { | |
aws = { | |
source = "hashicorp/aws" | |
version = ">= 5.0" | |
} | |
} | |
} | |
data "aws_partition" "current" {} |
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
import json | |
import boto3 | |
import botocore | |
import os | |
import datetime | |
import re | |
import csv | |
from functools import lru_cache | |
sts = boto3.client("sts") |
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
# See documented events sent by Config here: https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_develop-rules_example-events.html | |
# | |
# It is much easier to write evaluations for rules using ConfigurationItemChangeNotification and | |
# OversizedConfigurationItemChangeNotification. These notifications include the resource as recorded | |
# by Config. The Lambda function can review the resource config json and submit an evaluation for | |
# the resource. | |
# | |
# ScheduledNotification events are not specific to a resource, the event only includes | |
# the account id and rule name. Lambda functions must list all the resources in the account using | |
# service apis, call the appropriate apis to evaluate the resources config, and then submit |
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
#!/usr/bin/env python3 | |
# Example usage: | |
# | |
# ~ $ export AWS_PROFILE=organization-management-account | |
# ~ $ export AGGREGATOR_NAME=my-config-aggregator | |
# ~ $ python ~/tmp/config_aggregator_query.py | |
# 53 resources inspected | |
# |
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
# Usage examples: | |
# | |
# Create a new CodeCommit repository with CodeBuild CI/CD | |
# | |
# aws cloudformation deploy \ | |
# --stack-name my-new-project \ | |
# --template-file ./template.yml \ | |
# --capabilities CAPABILITY_IAM \ | |
# --parameter-overrides 'RepositoryDescription=My new project description' | |
# |
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
# Install GNU parallel in a CentOS-based docker container (e.g. for CI/CD) | |
# install needed dependencies | |
yum install -q -y bzip2 tar make perl | |
# download source | |
curl -s -L -o /tmp/parallel.tar.bz2 https://ftpmirror.gnu.org/parallel/parallel-latest.tar.bz2 | |
# extract source | |
tar -C /tmp -xjf /tmp/parallel.tar.bz2 | |
# navigate into extracted source | |
cd /tmp/parallel-* | |
# build and install |
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/sh | |
set -eux | |
CA_FILE_PREFIX="${CA_FILE_PREFIX:-"example-corp-ca"}" | |
CA_CN="${CA_CN:-"Example Corp CA"}" | |
CA_SUBJ="${CA_SUBJ:-"/C=US/O=Example Corp/CN=${CA_CN}"}" | |
SERVER_CN="${SERVER_CN:-"server.example.com"}" | |
SERVER_FILE_PREFIX="${SERVER_FILE_PREFIX:-"${SERVER_CN}"}" | |
SERVER_SUBJ="${SERVER_SUBJ:-"/C=US/O=Example Corp/CN=${SERVER_CN}"}" |
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
Description: > | |
Builds a basic /24 2x2 VPC (Public/Private, 2 AZs). The VPC CIDR block is determined by a combination | |
of the account ID and Region, giving a _very strong_ probability of a unique range within an | |
Organization. | |
Parameters: | |
VpcNameTag: | |
Type: String | |
Default: 2x2 | |
VpcCidrSuffix: |
NewerOlder