Skip to content

Instantly share code, notes, and snippets.

View edhull's full-sized avatar
:shipit:

Ed Hull edhull

:shipit:
View GitHub Profile
@edhull
edhull / python_generate_presigned_s3_upload_url_webpage.py
Created August 30, 2023 13:19
Python which will generate a pre-signed S3 upload URL, and populate a static HTML page facilitating a file upload to that bucket using that pre-signed url. The policy enforces that object tagging must be present.
import boto3
import copy
from botocore.exceptions import NoCredentialsError
# Replace value with your own
bucket_name = 'bucket'
"""
Ensure your S3 bucket has the following CORS (or more restrictive)
[
@edhull
edhull / source_dest_check_disabler.py
Created February 14, 2023 15:14
Disable the source/destination check of an EC2 instance with AWS Lambda
import os
import json
import boto3
import logging
log = logging.getLogger()
log.setLevel(os.environ.get("LOG_LEVEL", "INFO"))
ec2_client = boto3.client('ec2', region_name=os.environ.get("AWS_REGION"))
ec2_resource = boto3.resource('ec2', region_name=os.environ.get("AWS_REGION"))
@edhull
edhull / restrict-aws-ecr-pull-through-cache.md
Created January 13, 2022 17:58
Restrict AWS ECR Pull-Through Cache to a limited number of upstream repositories via Registry Permission

Keybase proof

I hereby claim:

  • I am edhull on github.
  • I am edhull (https://keybase.io/edhull) on keybase.
  • I have a public key ASCjdZMCwLspgj4CmkdVYlJh3M1k9-sabHg550Tgf8onsgo

To claim this, I am signing this object: