This file contains 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
INSTANCE_ID=`aws ec2 run-instances --instance-type t2.micro \ | |
--user-data file://user-data.sh \ | |
--security-group-ids sg-569b5555 \ | |
--instance-initiated-shutdown-behavior terminate \ | |
--iam-instance-profile "Name=nonono" \ | |
--image-id ami-0b33d91d \ | |
--count 1 \ | |
--key-name bastion-host \ | |
--region us-east-1 --query "Instances[0].InstanceId" | sed 's/"//g'` |
This file contains 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
mkdir SampleLambdaFunction | |
chmod 644 SampleLambdaFunction.py | |
cp SampleLambdaFunction.py SampleLambdaFunction | |
cd SampleLambdaFunction | |
pip install "elasticsearch>=2.0.0,<3.0.0" -t . | |
pip install requests_aws4auth -t . | |
zip -9r ../SampleLambdaFunction.zip . |
This file contains 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
#Creting network interfaces - ENIs | |
aws ec2 create-network-interface --subnet-id subnet-002f9xxx | |
aws ec2 create-network-interface --subnet-id subnet-002f9xxx | |
#Getting EIPs | |
aws ec2 allocate-address | |
aws ec2 allocate-address | |
#Associating EIPs to ENIs | |
aws ec2 associate-address --network-interface-id eni-xxxxxxx --allocation-id eipalloc-xxxxxxxx |
This file contains 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
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.Table(ddb_table) | |
table.put_item( | |
Item={ | |
'device_id': event['clientId'], | |
'timestamp': str(event['timestamp']), | |
'status': event['eventType'] | |
}, | |
ConditionExpression=':ts >= #ts_old OR attribute_not_exists(#ts_old)', |
This file contains 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
#!/bin/bash | |
wget http://mirror.nbtelecom.com.br/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz | |
tar zxvf apache-maven-3.5.0-bin.tar.gz | |
sudo yum install -y git java-devel | |
git clone https://github.com/Parquet/parquet-mr.git | |
cd parquet-mr/parquet-tools/ | |
sed -i 's/1.6.0rc3-SNAPSHOT/1.6.0/g' pom.xml | |
~/apache-maven-3.5.0/bin/mvn clean package -Plocal | |
java -jar target/parquet-tools-1.6.0.jar schema ~/000000_0 |
This file contains 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
#!/bin/bash | |
## Simple script to update the security group to allow ssh access from current IP. | |
## You can specify the Public DNS name of the instance that you want to access | |
## and it will update the first SG found. You can also setup a default SG and | |
## the script will update it and the DNS name is not informed. | |
SG="sg-xxxxxxxx" | |
REGION="us-east-1" |
This file contains 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
#!/bin/bash | |
BUCKET="s3-temp-folder" | |
FILENAME=`basename $1` | |
aws s3 cp $1 s3://$BUCKET/ | |
aws rekognition detect-labels --image "{ \"S3Object\" : { \"Bucket\" : \"$BUCKET\", \"Name\": \"$FILENAME\" } }" --min-confidence 80 |
This file contains 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
ddb_client = boto3.client("dynamodb", region_name='eu-west-1') | |
paginator = ddb_client.get_paginator("query") | |
pages = paginator.paginate( | |
TableName=TABLE_NAME, | |
ConsistentRead=False, | |
KeyConditionExpression="Identifier = :k", | |
ExpressionAttributeValues={ | |
":k" : { "S" : key } | |
}, |
This file contains 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
#!/bin/bash | |
SCRIPT=`basename "$0"` | |
if [ $# -eq 0 ] | |
then | |
echo "No arguments supplied" | |
echo "$SCRIPT thing-name" | |
exit | |
fi |
This file contains 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
#!/bin/bash | |
#Setup | |
SQS_MAX_NUMBER_OF_MESSAGES=1 # Mensagens extraídas da fila por vez | |
SQS_WAIT_TIME_SECONDS=20 # Esperar quanto tempo por uma mensagem na fila | |
#Obtain queue URL | |
QUEUE_URL=$(aws sqs get-queue-url --queue-name "dreis-rampup-queue" --output text) | |
#Send message |
OlderNewer