Skip to content

Instantly share code, notes, and snippets.

View aaronfranco's full-sized avatar

Aaron G Franco aaronfranco

  • New York
View GitHub Profile
import sys
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.dynamicframe import DynamicFrame
from awsglue.job import Job
from pyspark.sql.functions import udf
from pyspark.sql.types import StringType
glueContext = GlueContext(SparkContext.getOrCreate())
@aaronfranco
aaronfranco / gluejob.py
Created April 16, 2020 01:35
Sensitive Data Lake Blog
import sys
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.dynamicframe import DynamicFrame
from awsglue.job import Job
from pyspark.sql.functions import udf
from pyspark.sql.types import StringType
glueContext = GlueContext(SparkContext.getOrCreate())
var aws = require('aws-sdk');
var config = new aws.ConfigService();
var ec2 = new aws.EC2();
// This is where it's determined whether the resource is compliant or not.
// In this example, we look at the tenancy of the EC2 instance and determine whether it matches
// the "DesiredTenancy" parameter that is passed to the rule. If the tenancy is not of the DesiredTenancy type, the
// instance is marked non-compliant. Otherwise, it is marked complaint.
// Helper function used to validate input
exports.handler = async (event) => {
console.log(event);
};
var AWS = require('aws-sdk');
// Set the region
/*
* CHANGE THIS TO YOUR REGION
*/
AWS.config.update({region: 'us-east-2'});
// Create S3 service object
let s3 = new AWS.S3();
@aaronfranco
aaronfranco / copy-logs-lambda.js
Last active September 21, 2021 16:50
Analyzing Multi-Account WAF Logs with AWS Elasticsearch Service, Amazon Athena and QuickSight Scripts
// JavaScript
// Load the AWS SDK
const aws = require('aws-sdk');
// Construct the AWS S3 Object
const s3 = new aws.S3();
// Define variable for the destination bucket
var destBucket = "<central logging bucket name>";
@aaronfranco
aaronfranco / structured.js
Last active April 5, 2016 18:11
Structured-Hack
// JavaScript Code
var connected = false;
var doorOpen = false;
var timer = false;
// assume these are real things - NOT REAL! :)
var door = new DoggyDoor();
var collar = new CollarListener();
var app = {