Skip to content

Instantly share code, notes, and snippets.

View jewelsjacobs's full-sized avatar
:octocat:
Working

Julia Jacobs jewelsjacobs

:octocat:
Working
View GitHub Profile
@jewelsjacobs
jewelsjacobs / python3withpyenv.md
Created April 10, 2020 12:58
Install python 3 globally on Mac OS X with pyenv

Install python 3 globally on Mac OS X with pyenv

Taken from this blog article by Matthew Broberg (Redhat). I just wanted a small part and not the whole thing and this section was not linked.

Install pyenv via homebrew:

$ brew install pyenv
@jewelsjacobs
jewelsjacobs / files.sh
Last active September 27, 2020 18:53
Cleaned up local file structure #cognito
22 directories, 74 files
➜ aws-cdk git:(jjacobs/bump/feature) tree <aws:sandbox>
.
├── __tests__
│   └── test.cognito.ts
├── bin
│   └── cognito.ts
├── cdk.json
├── lib
│   ├── codebuild-lambda.ts
@jewelsjacobs
jewelsjacobs / sms-antispam-code-pipeline-role.ts
Last active September 19, 2019 17:24
Role construct that can be imported from a stack in same app or stack from another code base
import { Effect, PolicyStatement, Role, ServicePrincipal } from '@aws-cdk/aws-iam';
import { CfnOutput, Construct } from '@aws-cdk/core';
interface SMSAntispamCodePipelineRoleProps {
roleName: string;
}
/**
* SMSAntispamCodePipelineRole Construct
*
@jewelsjacobs
jewelsjacobs / sms-antispam-code-pipeline-role.ts
Created September 19, 2019 17:15
Role construct that can be imported from a stack in same app or stack from another code base
import { Effect, PolicyStatement, Role, ServicePrincipal } from '@aws-cdk/aws-iam';
import { CfnOutput, Construct } from '@aws-cdk/core';
interface SMSAntispamCodePipelineRoleProps {
roleName: string;
}
/**
* SMSAntispamCodePipelineRole Construct
*
@jewelsjacobs
jewelsjacobs / protection-policies.ts
Last active September 12, 2019 18:21
Stack and Resource Protection
#!/usr/bin/env node
import { CfnDeletionPolicy, CfnResource, Construct } from '@aws-cdk/core';
import { AwsCustomResource } from '@aws-cdk/custom-resources';
export interface ProtectionPoliciesProps {
resourceDeletionPolicy?: string; // "DELETE" | "RETAIN" | "SNAPSHOT"
terminationProtection?: boolean;
}
/**
@jewelsjacobs
jewelsjacobs / termination-protection-stack.ts
Last active September 3, 2019 22:14
CDK EnableTerminationProtection AWSCustomResource Example
import cdk = require('@aws-cdk/core');
import { Bucket } from '@aws-cdk/aws-s3';
import { AwsCustomResource } from '@aws-cdk/custom-resources';
export class TerminationProtectionStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// Enable stack termination protection
// using the AWS SDK CloudFormation updateTerminationProtection API:
@jewelsjacobs
jewelsjacobs / stack_simple.ts
Created September 3, 2019 19:08
App file for Cloudformation Deny Delete Policy POC
#!/usr/bin/env node
import 'source-map-support/register';
import cdk = require('@aws-cdk/core');
import { StackSampleStack } from '../lib/stack_sample-stack';
// import { Effect, PolicyDocument, PolicyStatement } from '@aws-cdk/aws-iam';
const app = new cdk.App();
const env: cdk.Environment = {
account: app.node.tryGetContext("account"),
@jewelsjacobs
jewelsjacobs / stack_sample-stack.ts
Last active September 3, 2019 19:17
Cloudformation Delete Deny Policy Document Simple Stack
import cdk = require('@aws-cdk/core');
import { Bucket } from '@aws-cdk/aws-s3';
import { Effect, PolicyDocument, PolicyStatement } from '@aws-cdk/aws-iam';
export class StackSampleStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// doesn't work (won't show up in synth and after deploy, I can still destroy)
const doc = new PolicyDocument();
@jewelsjacobs
jewelsjacobs / cdk.json
Created August 20, 2019 14:52 — forked from btotharye/app.py
CDK Python VPC with Flow Logs
{
"app": "python3 app.py",
"context": {
"serviceName": "vpc-cdk",
"dev": {
"cidr": "10.60.0.0/16",
"vpcAzCount": 1,
"region": "us-east-1"
}
}
#!/usr/bin/env node
import cdk = require('@aws-cdk/core');
import 'source-map-support/register';
import { ComponentStack } from '../lib/component-stack';
import { PipelineStack } from '../lib/pipeline-stack';
import { config } from '../scripts/config';
const app = new cdk.App();
const env: cdk.Environment = {