This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
required_keys = [ "key01", "key02", "key03", "key04" ] | |
ses_source = '[email protected]' | |
ses_destination = ['[email protected]'] | |
def lambda_handler(event, context): | |
if 'detail' in event and 'instance-id' in event['detail']: | |
ec2_instance_id = event['detail']['instance-id'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "Create Linux EC2 with postgresql96", | |
"Metadata": { | |
"Comment": "Postgres 9.6 on a r3.8xlarge + 20G EBS in a privateSubnet, and pgbench in publicSubnet" | |
}, | |
"Parameters": { | |
"Ec2KeyNameParam": { | |
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance", | |
"Type": "AWS::EC2::KeyPair::KeyName", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "Create AMR Cluster", | |
"Parameters": { | |
"ProductParam": { | |
"Description": "The EMR Product tag", | |
"Type": "String", | |
"Default": "aProductParam", | |
"MinLength": "3", | |
"MaxLength": "50", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: '2010-09-09' | |
Metadata: | |
Comment: "Stack for S3 event -> Lambda transform from csv to json -> kinesis stream -> downstream Lambda for each row processing. | |
These are the purpose of the demo: | |
- Retry of downstream Lambda when failed. The record in Kinesis Stream will not be removed until success Runtime | |
- With large CSV, the Lambda will parallel according to number of shards of Kinesis Stream" | |
Resources: | |
IAMRole: | |
Type: "AWS::IAM::Role" | |
Properties: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from awsglue.transforms import * | |
from awsglue.utils import getResolvedOptions | |
from pyspark.context import SparkContext | |
from awsglue.context import GlueContext | |
from awsglue.job import Job | |
import json | |
import requests | |
from pyspark import sql | |
from uuid import UUID |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import time | |
import threading | |
import json | |
import logging | |
import paho.mqtt.client as mqtt | |
import paho.mqtt.publish as mqtt_publish | |
import boto3 | |
subscriber_keepalive_sec = 40 * 60 # 40 mins |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, argparse | |
import boto3 | |
import pathlib | |
from pathlib import Path | |
import random | |
parser = argparse.ArgumentParser(description='Script to start OTA update') | |
parser.add_argument("--aws_profile", help="Profile name created using aws configure", default="default", required=False) | |
parser.add_argument("--s3bucket", help="S3 bucket to store firmware updates", required=True) | |
parser.add_argument("--s3prefix", help="S3 bucket prefix to store firmware updates", required=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!pip install --upgrade mxnet-cu$(ls /usr/local/cuda/lib64/libcudart.so.*.? | sed -e 's/.*\.\([0-9]*\.[0-9]*\)/\$1/g' -e 's/\.//g') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import urllib3 | |
def lambda_handler(event, context): | |
return { | |
'statusCode': 200, | |
'body': get_public_ip() | |
} | |
def get_public_ip(): |
OlderNewer