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
@allenmichael
allenmichael / Program.cs
Created October 1, 2019 19:06
SQSConsumer
using System;
using System.Threading.Tasks;
using Amazon.SQS;
using Amazon.SQS.Model;
using Newtonsoft.Json;
using SQSConsumer.Models;
using Amazon.SimpleSystemsManagement;
using Amazon.SimpleSystemsManagement.Model;
using System.Collections.Generic;
using Amazon.DynamoDBv2.DataModel;
apiVersion: v1
kind: Namespace
metadata:
name: gremlin
  • Best place to get started
  • https://eksworkshop.com/
  • Talk Minikube
  • Talk Play with Kubernetes
  • https://labs.play-with-k8s.com/
  • EKS Service Role
  • Create EKS Cluster (with same user who will use kubectl)
  • Talk about IAM and K8s RBAC
  • What is kubectl?
  • Use AWS CLI to update kubeconfig
AWSTemplateFormatVersion: "2010-09-09"
Description: >-
EKS for us-east-1 with Kubernetes Object deployment support.
Resources:
##### START VPC RESOURCES #####
VPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
InstanceTenancy: default
---
apiVersion: v1
kind: Namespace
metadata:
name: sock-shop
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: carts-db
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-addon: cluster-autoscaler.addons.k8s.io
k8s-app: cluster-autoscaler
name: cluster-autoscaler
namespace: kube-system
---
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
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'
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'
#!/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')