Skip to content

Instantly share code, notes, and snippets.

View alexcasalboni's full-sized avatar
✌️
Happy coding!

Alex Casalboni alexcasalboni

✌️
Happy coding!
View GitHub Profile
@alexcasalboni
alexcasalboni / serverless-resources.yml
Created January 4, 2018 20:51
Serverless Resources sample for Amazon Cognito IdentityPool
Resources:
WorkshopKinesisStream:
Type: "AWS::Kinesis::Stream"
Properties:
ShardCount: 1
IdentityPool:
Type: "AWS::Cognito::IdentityPool"
Properties:
IdentityPoolName: WorkshopIdentityPool
@alexcasalboni
alexcasalboni / ml.py
Created July 21, 2017 10:26
AmazonML Lab updated code
import boto3
from boto3.session import Session
session = Session(aws_access_key_id='AWS_ACCESS_KEY_ID', aws_secret_access_key='AWS_SECRET_ACCESS_KEY')
machinelearning = session.client('machinelearning', region_name='us-east-1')
labels = {'1': 'walking', '2': 'walking upstairs', '3': 'walking downstairs', '4': 'sitting', '5': 'standing', '6': 'laying'}
# fill your model ID and Endpoint here!
model_id = 'MODEL_ID'
prediction_endpoint = 'MODEL_ENDPOINT'
@alexcasalboni
alexcasalboni / tweets.json
Last active July 4, 2017 14:06
Serverless Highlights of 2017 - 1/2
[
"https://twitter.com//goserverless/status/879729046568882177",
"https://twitter.com//zdne/status/879726263417663490",
"https://twitter.com//jeffconf/status/879722357899894785",
"https://twitter.com//AzureFunctions/status/879458907453767680",
"https://twitter.com//adampash/status/877549817471279105",
"https://twitter.com//MongoDB/status/877186132404031488",
"https://twitter.com//alex_casalboni/status/875866754177748993",
"https://twitter.com//gmolto/status/872691887936811008",
"https://twitter.com//jeffconf/status/872451904642703360",
@alexcasalboni
alexcasalboni / aws-lambda-edge.md
Last active July 25, 2024 22:45
Serve dynamically generated, minimized and compressed HTML pages with AWS Lambda@Edge.

AWS Lambda@Edge Experiment

Requirements

  • AWS Lambda@Edge (enabled Preview)
  • One Amazon CloudFront Distribution (origin doesn't matter)
  • IAM role (basic execution is enough)
  • npm to install Node.js dependencies
@alexcasalboni
alexcasalboni / amazon-rekognition.md
Last active October 11, 2024 16:44
Amazon Rekognition - Python Code Samples

Amazon Rekognition - Python Code Samples

  1. Labels Detection
  2. Faces Detection
  3. Faces Comparison
  4. Faces Indexing
  5. Faces Search
@alexcasalboni
alexcasalboni / index.md
Last active November 30, 2022 06:22
Bridge Function between Kinesis Streams and Step Functions

Bridge Function between Kinesis Streams and Step Functions

For each record read from the Kinesis Stream, a StepFunction state machine will be executed asynchronously.

Required Environment Variables

  • region: the AWS region where your StepFunction state machine is defined.
  • stateMachineArn: the ARN of the StepFunction state machine you want to execute.

Notes

@alexcasalboni
alexcasalboni / boto3_getpolicy.py
Last active August 20, 2017 03:53
AWS IAM Policy body with Python and boto3
import boto3
iam = boto3.resource('iam')
def get_policy_body(arn, version_id=None):
""" Return IAM Policy JSON body """
if version_id:
version = iam.PolicyVersion(arn, version_id)
else:
policy = iam.Policy(arn)
@alexcasalboni
alexcasalboni / deploy.sh
Last active January 29, 2024 12:22
Simple AWS Lambda deployment script - Zip & upload Deployment Package with initial dependencies to S3
#!/bin/bash
BUCKET="YOUR_BUCKET_NAME" # bucket name
FILENAME="deployment-package.zip" # upload key
TMP_FOLDER="/tmp/lambda-env-tmp/" # will be cleaned
OUTPUT_FOLDER="/tmp/lambda-env/" # will be cleaned
HERE=${BASH_SOURCE%/*} # relative path to this file's folder
LAMBDA_FOLDER="$HERE/lambda/" # relative path
@alexcasalboni
alexcasalboni / 0-README.md
Last active December 11, 2020 22:41
AWS Lambda: Advanced Coding Session - clda.co/aws-lambda-webinar

AWS Lambda: Advanced Coding Session (slides)

Live demos:

  1. Amazon API Gateway Access Control
  2. Amazon Kinesis Streams processing
  3. Amazon Cognito Sync trigger
  4. AWS CloudFormation Custom Resources
@alexcasalboni
alexcasalboni / README.md
Created August 2, 2016 08:16 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Index: