Skip to content

Instantly share code, notes, and snippets.

@bo67192
bo67192 / infrainterest.csv
Last active December 17, 2020 13:08
Developer engagement and Infa interest
Engaged Not Engaged
High Infra Interest Flexible framework stored with app DevOps preference but give access to suggest changes
Low Infra Interest Opinionated framework stored with app DevOps preference but give view acess
@bo67192
bo67192 / options.csv
Last active December 17, 2020 12:50
AWS CICD Options
Common Real special
Very strict Use an opinionated but transparent framework Use a flexible transparent framework
Relaxed Pick an framework with an example of your stack Use the framework you have spent the most time in
@bo67192
bo67192 / chefcookbookcodebuildbuildspec.yml
Created December 10, 2016 19:26
Buildspec.yml file for building chef cookbooks
version: 0.1
phases:
install:
commands:
- sudo apt-get update -y
- sudo apt-get install -y wget
- sudo apt-get install -y gdebi
- wget https://packages.chef.io/stable/ubuntu/12.04/chefdk_1.0.3-1_amd64.deb
- gdebi -n chefdk_1.0.3-1_amd64.deb
@bo67192
bo67192 / chefcookbookcodebuildbuildspec.yml
Created December 5, 2016 00:22
buildspec.yml for chef cookbooks on AWS CodeBuild
version: 0.1
environment_variables:
plaintext:
key: "value"
key: "value"
phases:
install:
commands:
@bo67192
bo67192 / IAMpolicyforcloudwatchlogging.json
Created November 5, 2016 19:22
IAM policy for cloudwatch logging
{
"Version": "2012-10-17",
"Statement": [{
"Action": ["logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"],
"Resource": ["*"],
"Effect": "Allow",
"Sid": "Stmt1476220637000"
}]
@bo67192
bo67192 / iampolicythattrustslambda.json
Created November 5, 2016 19:20
Policy that trusts Lambda to assume
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
@bo67192
bo67192 / lambdafunctionloggingtocloudwatch.py
Last active November 5, 2016 19:17
Lambda function logging to Cloudwatch
import logging
# Setup cloud watch logging
logger.setLevel(logging.WARNING)
# Create boto3 EC2 resource
ec2 = boto3.resource('ec2')
def lambda_handler(event, context):
logger = logging.getLogger()
@bo67192
bo67192 / powershellgetec2instancefilterwhere.ps1
Created November 3, 2016 23:33
Powershell get-ec2instance with filter and piped to where
(Get-EC2Instance -filter @( @{name='tag:Name';values="*Webserver*"})).instances | where {$_.InstanceType -eq "t2.micro"}
@bo67192
bo67192 / powershellgetec2instancefilter.ps1
Created November 3, 2016 23:30
Powershell AWS get-ec2instance example with filter
(Get-EC2Instance -filter @( @{name='tag:Name';values="*Webserver*"})).instances
@bo67192
bo67192 / boto3instancefilter.py
Created November 3, 2016 23:22
Python example of using boto3 to filter instances and print their names
import boto3
# Create boto3 ec2 resource
ec2 = boto3.resource('ec2')
# Retrieve instances with a name tag that contains Webserver
filters = [{'Name':'tag:instanceSchedule', 'Values': ['*Webserver*']}]
instances = ec2.instances.filter(Filters=filters)