This file contains hidden or 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 { App, CfnOutput, Construct, Stack, StackProps } from '@aws-cdk/core'; | |
| import * as ec2 from '@aws-cdk/aws-ec2'; | |
| export class MyStack extends Stack { | |
| constructor(scope: Construct, id: string, props: StackProps = {}) { | |
| super(scope, id, props); | |
| const vpc = ec2.Vpc.fromLookup(this, 'Vpc', { isDefault: true }); | |
| const subnetId = vpc.privateSubnets[0].subnetId; |
This file contains hidden or 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 { App, Construct, Stack, StackProps, CfnParameter, CfnCondition, Fn } from '@aws-cdk/core'; | |
| import * as sns from '@aws-cdk/aws-sns'; | |
| export interface DemoProps { } | |
| export class Demo extends Construct { | |
| constructor(scope: Construct, id: string) { | |
| super(scope, id) | |
| const stack = Stack.of(this); |
This file contains hidden or 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
Show hidden characters
| // For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: | |
| // https://github.com/microsoft/vscode-dev-containers/tree/v0.128.0/containers/docker-from-docker | |
| { | |
| // "name": "Docker from Docker", | |
| // "dockerFile": "Dockerfile", | |
| "name": "jsii", | |
| "image": "jsii/superchain", | |
| "mounts": [ | |
| "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" | |
| ], |
This file contains hidden or 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 ec2 = require('@aws-cdk/aws-ec2'); | |
| import iam = require('@aws-cdk/aws-iam'); | |
| import { Stack } from '@aws-cdk/core'; | |
| const DEFAULT_CLUSTER_VERSION = '1.16' | |
| export class EksStack extends cdk.Stack { | |
| constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 | |
| } |