Skip to content

Instantly share code, notes, and snippets.

View alessandrobologna's full-sized avatar

Alessandro Bologna alessandrobologna

View GitHub Profile
@alessandrobologna
alessandrobologna / abtest.md
Last active April 14, 2024 04:07
apache benchmark test

Test from us-west-2

FURL direct invocation

[cloudshell-user@ip-10-134-76-174 ~]$ ab -c 1 -n 100 -k -H "authorization: $AUTH" https://dbnmtkykig3vobqu6f73dbgiam0qxeot.lambda-url.us-west-2.on.aws/todo-lists
This is ApacheBench, Version 2.3 <$Revision: 1903618 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking dbnmtkykig3vobqu6f73dbgiam0qxeot.lambda-url.us-west-2.on.aws (be patient).....done
@alessandrobologna
alessandrobologna / main.py
Created February 24, 2023 12:30
sigv4 sample
import boto3
from botocore.auth import SigV4Auth
from botocore.awsrequest import AWSRequest
session = boto3.Session()
credentials = session.get_credentials().get_frozen_credentials()
def make_signed_request(method, url, service_name, region, data=None, params=None, headers=None):
request = AWSRequest(method=method, url=url, data=data, params=params, headers=headers)
SigV4Auth(credentials, service_name, region).add_auth(request)
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS CloudFormation Sample Template EC2ChooseAMI: Example to show how to chose an AMI based on the region and the architecture type. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters" : {
"InstanceType" : {
"Description" : "WebServer EC2 instance type",
"Type" : "String",
"Default" : "m1.small",
CREATE EXTERNAL TABLE `ticker_symbols`(
`ticker_symbol` string,
`sector` string,
`change` double,
`price` double,
`firehose` struct<record_id:string,timestamp:bigint>
)
PARTITIONED BY (
`year` string,
`month` string,
GlueNotificationEventRule:
Type: AWS::Events::Rule
Properties:
Name: !Sub '${ProjectName}-glue-events-${Stage}'
State: ENABLED
EventPattern:
source:
- aws.glue
detail-type:
- Glue Data Catalog Database State Change
{
"version": "0",
"id": "5089ddb8-2ab5-4739-7323-8519741f53d7",
"detail-type": "Glue Data Catalog Database State Change",
"source": "aws.glue",
"account": "123456789012",
"time": "2019-04-25T15:40:07Z",
"region": "us-east-1",
"resources": [
"arn:aws:glue:us-east-1:123456789012:table/dbname/table_name"
GlueNotificationEventRule:
Type: AWS::Events::Rule
Properties:
Name: !Sub '${ProjectName}-glue-events-${Stage}'
State: ENABLED
EventPattern:
source:
- aws.glue
detail-type:
- Glue Data Catalog Database State Change
@alessandrobologna
alessandrobologna / all-conditons.json
Last active August 6, 2018 16:04
s3 tag policies
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "test01",
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "*",
"Condition": {
"ForAllValues:StringEquals": {
/*
* Just consume events from Kinesis in a sink
*/
const pause = parseInt(process.env.PAUSE_TIME || '0');
//const pause = 0;
const sleep = (ms) => {
return new Promise(resolve => setTimeout(resolve, ms));
};
[
{
"kinesis": {
"approximateArrivalTimestamp": 1521218148.073,
"kinesisSchemaVersion": "1.0",
"partitionKey": "a1627837-a899-4dab-851e-98530ce557aa",
"sequenceNumber": "49582644240588213996014774893955628290209495172536860674",
"data": {
"MessageType": "Claps",
"EntitySequenceId": "0",