Skip to content

Instantly share code, notes, and snippets.

View allenmichael's full-sized avatar

Allen-Michael Grobelny allenmichael

  • Amazon Web Services
  • Austin, TX
  • X @amsxbg
View GitHub Profile
# Creating and adding key to Cloud9 environment
ssh-keygen -f ~/path/to/store/key
cat key.pub | pbcopy
# Restarting an environment
INSTANCE_ID=$(aws ec2 describe-instances --filters "Name=tag-key,Values=Environment" "Name=tag-value,Values=Testing" --query Reservations[0].Instances[0].[InstanceId] --output text)
aws ec2 describe-instance-status --instance-ids $INSTANCE_ID
aws ec2 start-instances --instance-ids $INSTANCE_ID
aws ec2 describe-instances --filters "Name=tag-key,Values=Environment" "Name=tag-value,Values=Testing" --query Reservations[].Instances[].[PublicDnsName,InstanceId,Status]
openssl genrsa 2048 > private.pem
openssl req -x509 -new -key private.pem -out public.pem
openssl pkcs12 -export -in public.pem -inkey private.pem -out cert.pfx
cat cert.pfx | base64
import csv
def detect_type(t, s):
if s is '':
print(f'{t} is unknown type')
return {t: 'null'}
if s.isdigit():
print(f'{t} is an int')
return {t: 'int'}
else:
import * as cdk from '@aws-cdk/core';
import * as ec2 from "@aws-cdk/aws-ec2";
import * as ecs from "@aws-cdk/aws-ecs";
import * as secrets from "@aws-cdk/aws-secretsmanager";
import * as ecs_patterns from "@aws-cdk/aws-ecs-patterns";
import { Aws } from '@aws-cdk/core';
export class CdkStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
apiVersion: apps/v1
kind: Deployment
metadata:
name: esoteric-api
labels:
app: esoteric-api
namespace: default
spec:
replicas: 1
selector:
#!/bin/bash
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
EVENT_SOURCE_NAME=$(aws events list-event-sources --query 'EventSources[?CreatedBy == `aws.partner/auth0.com`]|[0].Name' --output text)
RULE_NAME=auth0
FUNCTION_NAME=Auth0Logs
aws events create-event-bus --name $EVENT_SOURCE_NAME --event-source-name $EVENT_SOURCE_NAME
EVENT_PATTERN=$(jq -r .EventPattern event-pattern.json | jq --arg ACCOUNT "$ACCOUNT_ID" '.account = $ACCOUNT' | jq 'tostring')
aws s3api list-buckets --query "Buckets[].Name" --output text | \
xargs -n1 -I{} sh -c 'aws s3api get-bucket-location --bucket {} --output text | xargs -n1 -I@ echo {} @' | \
xargs -n2 sh -c 'if [ $1 == "None" ]; then echo $0 - us-east-1 ; else echo $0 - $1 ; fi'
aws ec2 describe-regions --query 'Regions[?RegionName != `ap-east-1`]|[?RegionName != `ap-northeast-3`].[RegionName]' --output text | \
xargs -n1 -I{} sh -c 'aws lambda list-functions --region {} --query '"'"'Functions[?starts_with(Runtime, `nodejs8`) == `true`].[FunctionName]'"'"' --output text'
helm init --service-account tiller
helm repo add gremlin https://helm.gremlin.com
# Under the Configurations tab, download and copy your Gremin Certificates key and cert onto the EC2 bastion host.
# Be sure to name your files gremlin.cert and gremlin.key.
# See this documentation for more info on retrieving the Gremlin Certificates:
# https://www.gremlin.com/docs/infrastructure-layer/authentication/#downloading-the-certificate
# You can alternatively use vim
nano gremlin.cert
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-addon: cluster-autoscaler.addons.k8s.io
k8s-app: cluster-autoscaler
name: cluster-autoscaler
namespace: kube-system
---