Skip to content

Instantly share code, notes, and snippets.

View scottnixonjr's full-sized avatar

Scott Nixon scottnixonjr

View GitHub Profile
#!/bin/bash
# parameters
STACK=$(jq -r .stack parameters.json)
REGION=$(jq -r .region parameters.json)
TEMPLATE=file://${STACK}.yml
echo "Creating $STACK Stack"
aws cloudformation create-stack --stack-name $STACK \
#!/bin/bash
STACK=$(jq -r .stack parameters.json)
REGION=$(jq -r .region parameters.json)
echo "Deleting $STACK Stack"
aws cloudformation delete-stack --stack-name $STACK
aws cloudformation wait stack-delete-complete --stack-name $STACK --region $REGION
#!/bin/bash
# Import parameters
STACK=$(jq -r .stack parameters.json)
REGION=$(jq -r .region parameters.json)
TEMPLATE=file://${STACK}.yml
echo "Updating $STACK Stack"
aws cloudformation update-stack --stack-name $STACK \
--template-body $TEMPLATE \
Parameters:
BranchName:
Description: GitHub branch name
Type: String
Default: master
RepositoryName:
Description: GitHub repository name
Type: String
Default: test
GitHubOwner:
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
CFN_FILE=file://$(pwd)/github_service_account.yaml
STACK='github-service-account'
REGION='us-east-1'
if ! (aws cloudformation describe-stacks --region ${REGION} --stack-name ${STACK}) ; then
# Get all IAM actions for Tagging using policy_sentry database.
# Not perfect query because it will include actions that contain 'tAg' --> 'artifact:AcceptAgreement'
policy_sentry query action-table --service all | for i in $(cat); do policy_sentry query action-table --service $i; done | grep -i tag > all-aws-tag-actions.txt
@scottnixonjr
scottnixonjr / flexible_policy_permission_boundary.json
Created April 16, 2020 17:27
Permission boundary for creating EC2 Instances for Solution 3 in Developer Sandboxes - https://github.com/stelligent/developer-sandboxes
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"cloudformation:ListExports",
"sts:DecodeAuthorizationMessage"
],
@scottnixonjr
scottnixonjr / full_attribute_based_policy.json
Created April 16, 2020 17:38
Flexible Attribute based Access Control for creating EC2 Instances for Solution 3 in Developer Sandboxes - https://github.com/stelligent/developer-sandboxes
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "ec2:RunInstances",
"Resource": "arn:aws:ec2:*:*:instance/*",
"Condition": {
"StringEqualsIgnoreCase": {
@scottnixonjr
scottnixonjr / username_based_policy.json
Created April 16, 2020 18:10
Individual Access Control based on Username for creating EC2 Instances. Policy for Solution 2 in Developer Sandboxes - https://github.com/stelligent/developer-sandboxes
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "ec2:RunInstances",
"Resource": "arn:aws:ec2:*:*:instance/*",
"Condition": {
"StringEqualsIgnoreCase": {