Skip to content

Instantly share code, notes, and snippets.


Michael Fecher michaelfecher

View GitHub Profile
michaelfecher / cdk_remove_hard_codings-using_env_vars.ts
Created Oct 31, 2020
AWS CDK - Configurabe values: Simple, independent (from deployment environment), but intransparent/
View cdk_remove_hard_codings-using_env_vars.ts
// source:
export class VpcStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
// reading the value from the env.
// Obviously, you have to set it before or pass it before you call any cdk command
const vpcCidr = process.env.VPC_CIDR;
new Vpc(this, 'VPC', {
maxAzs: 3,
View cdk_code_organization_with_ecs.txt
# ECS specific CDK code organization
|- pipeline (main cdk-app, stacks, taskdefinitions for app_A & app_B**)
|- app_A (buildspec, imports A specific stuff from pipeline)
|- app_B (buildspec, imports B specific stuff from pipeline)
|- cicd (=> Build/Test + Docker Build/Push + ECR CodeDeploy)
michaelfecher / cross-account-code-pipeline-stack.ts
Created Aug 19, 2020
CDK CodePipeline/CodeBuild Cross Account Deployment Issue (permission denied)
View cross-account-code-pipeline-stack.ts
import * as cdk from "@aws-cdk/core";
import * as codecommit from "@aws-cdk/aws-codecommit";
import * as codebuild from "@aws-cdk/aws-codebuild";
import * as codepipeline from "@aws-cdk/aws-codepipeline";
import * as codepipeline_actions from "@aws-cdk/aws-codepipeline-actions";
import * as iam from "@aws-cdk/aws-iam";
export class CrossAccountCodePipelineStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props: cdk.StackProps) {
super(scope, id, props);
michaelfecher / backend-task-stack.ts
Created Jul 25, 2020
Blogpost: ECS Fargate with passing secrets - ECS Fargate Task Definition
View backend-task-stack.ts
// file: lib/backend-task-stack.ts
import * as cdk from "@aws-cdk/core";
import * as ecs from "@aws-cdk/aws-ecs";
import * as iam from "@aws-cdk/aws-iam";
import * as ecr from "@aws-cdk/aws-ecr";
import { DBCredentials } from "./db-credentials-stack";
export interface BackendStackProps extends cdk.StackProps {
backendPort: number;
dbEndpoint: string;
michaelfecher / db-credentials-stack.ts
Created Jul 25, 2020
Blogpost: ECS Fargate Passing secrets: DB credentials import in CDK
View db-credentials-stack.ts
// file: lib/db-credentials-stack.ts
import { ISecret, Secret } from "@aws-cdk/aws-secretsmanager";
import * as cdk from "@aws-cdk/core";
export interface DBCredentials {
username: ISecret;
password: ISecret;
export class DbCredentialsStack extends cdk.Stack {
michaelfecher / rds-stack.ts
Created Jul 25, 2020
Blogpost: ECS Fargate Secret Usage, RDS part
View rds-stack.ts
// file: lib/rds-stack.ts
import * as cdk from "@aws-cdk/core";
import * as ec2 from "@aws-cdk/aws-ec2";
import * as rds from "@aws-cdk/aws-rds";
import { DBCredentials} from "./db-credentials-stack";
export interface RDSStackProps extends cdk.StackProps {
vpc: ec2.Vpc;
credentials: DBCredentials;
michaelfecher /
Created Feb 12, 2019
keybase verification

Keybase proof

I hereby claim:

  • I am michaelfecher on github.
  • I am michaelfecher ( on keybase.
  • I have a public key ASA9tKMNEdTVaK20y4oNVAaB1P0Twzlk3G5OChZ29zP2aAo

To claim this, I am signing this object:

You can’t perform that action at this time.