Skip to content

Instantly share code, notes, and snippets.

@MitchyBAwesome
MitchyBAwesome / buildspec.yml
Created July 9, 2018 00:04
build-spec-for-command-line-pipeline
version: 0.2
phases:
pre_build:
commands:
- echo -n "$CODEBUILD_BUILD_ID" | sed "s/.*:\([[:xdigit:]]\{7\}\).*/\1/" > /tmp/build_id.out
- printf "%s:%s" "$REPOSITORY_URI" "$(cat /tmp/build_id.out)" > /tmp/build_tag.out
- echo "$(cat /tmp/build_tag.out)"
- printf '[{"name":"go-http-server","imageUri":"%s"}]' "$(cat /tmp/build_tag.out)" > imagedefinitions.json
- echo Logging in to Amazon ECR...
@MitchyBAwesome
MitchyBAwesome / script.sh
Created July 5, 2018 04:45
Bash Script to Setup Fargate Service
#!/bin/bash
ACCOUNT_ID="xxxxxxxx" && \
REGION="us-west-2" && \
REPO="go-http-server"
# Login to ecr
$(aws ecr get-login --no-include-email --region ${REGION})
@MitchyBAwesome
MitchyBAwesome / go-http-server.json
Created July 3, 2018 07:34
Simple Go Web Service Task Definition
{
"family": "go-http-server",
"networkMode": "awsvpc",
"executionRoleArn": "arn:aws:iam::614658524125:role/ecsTaskExecutionRole",
"containerDefinitions": [
{
"name": "go-http-server",
"image": "614658524125.dkr.ecr.us-west-2.amazonaws.com/go-http-server:latest",
"portMappings": [
{
@MitchyBAwesome
MitchyBAwesome / eks-iam-blog-aws-auth-configmap-role.yaml
Created June 23, 2018 07:48
eks-iam-blog-aws-auth-configmap-role
---
apiVersion: v1
kind: ConfigMap
metadata:
name: aws-auth
namespace: kube-system
data:
mapRoles: |
- rolearn: <ARN of instance role (not instance profile)>
username: system:node:{{EC2PrivateDNSName}}
@MitchyBAwesome
MitchyBAwesome / eks-iam-blog-aws-auth-configmap-user.yaml
Created June 23, 2018 07:44
eks-iam-blog-aws-auth-configmap-user
---
apiVersion: v1
kind: ConfigMap
metadata:
name: aws-auth
namespace: kube-system
data:
mapRoles: |
- rolearn: <ARN of instance role (not instance profile)>
username: system:node:{{EC2PrivateDNSName}}
@MitchyBAwesome
MitchyBAwesome / role-binding.yaml
Last active June 23, 2018 07:41
Role Binding to give mapped user access to edit cluster role
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: curly-edit
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: edit
subjects:
EKSInstanceLaunchTemplate:
Type: "AWS::EC2::LaunchTemplate"
Properties:
LaunchTemplateData:
TagSpecifications:
- ResourceType: instance
Tags:
- Key: !Sub "kubernetes.io/cluster/${CatsnDogsEKSCluster}"
Value: "owned"
- Key: "Name"
.
├── Dockerfile
├── README.md
├── images
│   ├── 1.jpg
│   ├── 10.jpg
│   ├── 2.jpg
│   ├── 3.jpg
│   ├── 4.jpg
│   ├── 5.jpg