This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. update your aws cli | |
# https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html | |
# | |
# 2. update your existing cluster with capacity providers support | |
CLUSTER_NAME=fargate | |
SERVICE_NAME=myservice | |
FARGATE_WEIGHT=1 | |
FARGATE_SPOT_WEIGHT=1 | |
FARGATE_BASE=1 | |
FARGATE_SPOT_BASE=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cdk = require('@aws-cdk/core'); | |
import { Vpc } from '@aws-cdk/aws-ec2'; | |
import { Cluster, ContainerImage, TaskDefinition, Compatibility } from '@aws-cdk/aws-ecs'; | |
import { ApplicationLoadBalancedFargateService } from '@aws-cdk/aws-ecs-patterns'; | |
import path = require('path') | |
export class FargateAlbSvcStack extends cdk.Stack { | |
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { | |
super(scope, id, props); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cdk = require('@aws-cdk/core'); | |
import eks = require('@aws-cdk/aws-eks'); | |
import iam = require('@aws-cdk/aws-iam'); | |
import autoscaling = require('@aws-cdk/aws-autoscaling'); | |
import { InstanceType } from '@aws-cdk/aws-ec2'; | |
export class CdkStack extends cdk.Stack { | |
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { | |
super(scope, id, props); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Usage: bash create-job.sh S3_INPUT_VIDEO_FILE_PATH | |
# e.g. bash create-job.sh s3://your-s3-bucket/your-input-video.mov | |
input=$1 | |
basename=$(basename $input) | |
newbasename="${basename%%.*}-H264-AAC.mp4" | |
output="$(dirname $input)/$newbasename" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list buckets starting with 'codebuild' | |
buckets=($(aws s3api list-buckets --query 'Buckets[?starts_with(Name, `codepipeline-`) == `true`].Name' --output text)) | |
# delete them | |
for b in ${buckets[@]} | |
do | |
aws s3 rb --force s3://${b} | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TMPKEY="my-ssh-tmp-key-${RANDOM}" | |
EC2USER='ec2-user' | |
generate_ssh_key_pair(){ | |
ssh-keygen -t rsa -f ~/.ssh/${TMPKEY} -N "" && \ | |
chmod 600 ~/.ssh/${TMPKEY}.pub | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# export the task def | |
family='TaskDefName' | |
$ aws ecs describe-task-definition --task-definition $family \ | |
--query "taskDefinition.{family:family, taskRoleArn:taskRoleArn, executionRoleArn:executionRoleArn, networkMode:networkMode, containerDefinitions:containerDefinitions, volumes:volumes, placementConstraints:placementConstraints, requiresCompatibilities:requiresCompatibilities, cpu:cpu, memory:memory, tags:tags, pidMode:pidMode, ipcMode:ipcMode, proxyConfiguration:proxyConfiguration}" | jq 'del(.[] | nulls)' > taskDef.json | |
# import the task def into newFamily task family | |
$ aws ecs register-task-definition --cli-input-json file://taskDef.json --family newFamily | |
# one-liner | |
aws ecs describe-task-definition --task-definition $family \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx-deployment | |
labels: | |
app: nginx | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: caddy-service | |
spec: | |
selector: | |
app: caddy-pod | |
ports: | |
- name: web |