Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
from aws_cdk import (
core as cdk_core,
aws_s3 as cdk_s3,
aws_s3_deployment as cdk_s3_deploy
)
class FrontendStack(cdk_core.Stack):
def __init__(self, app, id, **kwargs):
@bgdnlp
bgdnlp / cognito-test.py
Last active October 11, 2024 16:44
Sign up and log in to Cognito, check tokens, then call an API. Details: https://www.neant.ro/aws/working-with-cognito-and-api-gateway-in-python.html
#!/usr/bin/env python3
# Demonstrates the use of Python to work with Cognito.
# Create a new a user, log in, check tokens and call an API.
# The purpose was to learn about Cognito. Security has been
# circumvented in the interest of keeping it simple.
# Notably, the authentication procedure uses the most insecure
# method. This code is not intended for use in production.
#
# https://www.neant.ro/aws/working-with-cognito-and-api-gateway-in-python.html
# needs Python3, though easily adapted
from __future__ import unicode_literals
import boto3
def main():
session = boto3.session.Session(profile_name='aws_credentials_profile')
ec2 = session.resource('ec2')
# define instance parameters
#!/bin/bash
#
# efsaz Set availability zone for EFS mounts in fstab
#
# chkconfig: 345 24 74
# description: Replaces the availability zone for EFS mount points in fstab \
# with the proper value for the current instance, which it gets \
# from instance metadata. This script must run before the \
# netfs script, which mounts network filesystems. It is useful \
# in autoscaling groups, where the instance starting might \
@bgdnlp
bgdnlp / azkaban-web
Last active November 14, 2015 08:26
Azkaban web server init.d script
#!/bin/bash
#
# azkaban-web Start Up Azkaban web server
#
# chkconfig: 2345 95 5
# description: Azkaban allows users to run queries on EMR (Hadoop) clusters \
# via a web interface
### BEGIN INIT INFO
# Provides: azkaban
# Find the IAM username belonging to the TARGET_ACCESS_KEY
# Useful for finding IAM user corresponding to a compromised AWS credential
# Requirements:
#
# Environmental variables:
# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
# python:
# boto