Skip to content

Instantly share code, notes, and snippets.

AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: Creates an API Gateway to publish data to a SQS queue.
Resources:
ApiQueue:
Type: AWS::SQS::Queue
ApiRole:
@brysontyrrell
brysontyrrell / s3tester.py
Created April 1, 2021 14:18
Code used for a Lambda function testing S3 object read speeds.
import hashlib
import time
import boto3
s3 = boto3.resource("s3")
BUCKET = "my-bucket"
KEYS = [
"test100mb.file",
@brysontyrrell
brysontyrrell / jamfpro-docker-compose.yml
Created November 25, 2019 14:16
A Docker Compose file for launching Jamf Pro
version: "3"
services:
mysql:
image: "mysql:5.7"
networks:
- jamfnet
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: "jamfsw03"
@brysontyrrell
brysontyrrell / ami-lookup.yaml
Created November 30, 2019 21:04
A CloudFormation custom resource to perform the lookup of the latest NAT instance AMI ID for the region.
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Resources:
NatInstaceAmi:
Type: AWS::CloudFormation::CustomResource
Properties:
ServiceToken: !GetAtt NatInstanceAmiLookup.Arn
from datetime import datetime
import json
import os
import boto3
EVENT_BUS = os.getenv("EVENT_BUS")
events_client = boto3.client("events")
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Resources:
HttpApi:
Type: AWS::Serverless::HttpApi
Properties:
StageName: prod
DefinitionBody:
MyTable:
Type: AWS::DynamoDB::Table
Properties:
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: pk
AttributeType: S
- AttributeName: sk
AttributeType: S
- AttributeName: gsi1_pk
MyFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: python3.8
CodeUri: ./src/my_function
Handler: index.lambda_handler
Events:
TableChanges:
Type: EventBridgeRule
Properties:
# Run from a directory that contains your ROOT.war file.
# Change VERSION to that of the ROOT.war being deployed
VERSION=10.17.0
docker build . -t jamfpro:${VERSION} -f - <<EOF
FROM jamfdevops/jamfpro:0.0.10
ADD ROOT.war /data/
EOF
import base64
import getpass
import sys
import xml.etree.ElementTree as Et
import urllib
import urllib2
reload(sys)
sys.setdefaultencoding('utf-8')