Skip to content

Instantly share code, notes, and snippets.

View jasonmimick's full-sized avatar
🌥️
build in the cloud

Jason Mimick jasonmimick

🌥️
build in the cloud
View GitHub Profile
eksctl create cluster --region us-east-1 --enable-types all --fargate --name cluster-name
apiVersion: batch/v1
kind: Job
metadata:
name: mongocli
namespace: mongodb
spec:
template:
spec:
restartPolicy: Never
containers:
#!/usr/bin/env bash
# Fetch latest mongocli for bundling
TARBALL=$(curl -sL https://github.com/mongodb/mongocli/releases/latest | grep ".tar.gz" | head -1 | cut -d'=' -f2 | cut -d' ' -f1)
echo "Fetching ${TARBALL}"
curl -OL "https://github.com${TARBALL}"
tar xvf ${TARBALL}
cp ${TARBALL}/mongocli ./mongocli.latest
rm ${TARBALL}
ls -l ./*mongocli*
@jasonmimick
jasonmimick / dev-docker-shell.sh
Created April 26, 2021 19:48
Helper for cfn dev
#!/usr/bin/env bash
echo "MongoDB Atlas CloudFormation Resource Devloper Docker Shell"
echo "-----------------------------------------------------------"
if [ -x "$(command -v mongocli)" ]; then
echo 'No apikey arguments detected and mongocli installed, will use default mongocli profile.'
MCLI_ARGS=$(./export-mongocli-config.py default spaces)
export MCLI_PUBLIC_API_KEY=$(echo ${MCLI_ARGS} | cut -d' ' -f1)
export MCLI_PRIVATE_API_KEY=$(echo ${MCLI_ARGS} | cut -d' ' -f2)
@jasonmimick
jasonmimick / Dockerfile.sdk
Created April 26, 2021 19:47
special dockerfile for cfn devs
# syntax=docker/dockerfile:1.0.0-experimental
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
ARG AWS_DEFAULT_REGION
ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
ARG AWS_SESSION_TOKEN
ARG CFN_CLI_SDK
RUN apt-get update && apt-get install -y \
@jasonmimick
jasonmimick / dev-docker-shell.sh
Created April 26, 2021 17:54
Helper for cfn dev
#!/usr/bin/env bash
echo "MongoDB Atlas CloudFormation Resource Devloper Docker Shell"
echo "-----------------------------------------------------------"
if [ -x "$(command -v mongocli)" ]; then
echo 'No apikey arguments detected and mongocli installed, will use default mongocli profile.'
MCLI_ARGS=$(./export-mongocli-config.py default spaces)
export MCLI_PUBLIC_API_KEY=$(echo ${MCLI_ARGS} | cut -d' ' -f1)
export MCLI_PRIVATE_API_KEY=$(echo ${MCLI_ARGS} | cut -d' ' -f2)
@jasonmimick
jasonmimick / aws-access-lister.sh
Created April 21, 2021 12:57
Add all AWS IP ranges to a MongoDB Atlas Org api key access list
#!/usr/bin/env bash
#
# aws-access-lister.sh
#
# This utility script can be used to maintain the Access List for
# a MongoDB Atlas Programatic API Key. For example, when running on AWS lambda
# the IP-address of the host is not know beforehand and thus it's not possible to
# securly configure an api key. This script will dynamically fetch a valid set of
# IP ranges directly from AWS and then either create a new apikey or modify an existing key
@jasonmimick
jasonmimick / aws-access-lister.sh
Last active April 20, 2021 17:56
Add all AWS IP ranges to a MongoDB Atlas Org api key access list
#!/usr/bin/env bash
#PUBLIC_KEY=${1:-${ATLAS_PUBLIC_KEY}}
#PRIVATE_KEY=${1:-${ATLAS_PRIVATE_KEY}}
#ORG_ID=${1:-${ATLAS_ORG_ID}}
#
# aws-access-lister.sh
#
#!/usr/bin/env bash
REGION="${1:-us-east-1}"
FILTER="${2:-XXX}"
STACKS=$(aws cloudformation describe-stacks --region ${REGION} --output text --query 'Stacks[*].{Stack:StackName}' | grep "${FILTER}")
if [[ "$*" == *killall* ]]
then
echo "*********** killall initiated ******************"
STACKS=$(aws cloudformation describe-stacks --region ${REGION} --output text --query 'Stacks[*].{Stack:StackName}')
echo "Region: ${REGION} Stacks: ${STACKS}"
fi
{
"typeName": "MongoDB::Atlas::Deployment",
"description": "An example resource schema demonstrating some basic constructs and validation rules.",
"sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git",
"definitions": {
"ApiKey": {
"type": "object",
"$comment": "A valid MongoDB Cloud API Key",
"properties": {
"PublicKey": {