Skip to content

Instantly share code, notes, and snippets.

View tecmaverick's full-sized avatar

AbrahamJP tecmaverick

View GitHub Profile
@tecmaverick
tecmaverick / template.yaml
Created December 12, 2019 10:27 — forked from danilop/template.yaml
Sample AWS SAM Template using Provisioned Concurrency with Application Auto Scaling
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
Sample SAM Template using Application Auto Scaling + Provisioned Concurrency
Globals:
Function:
Timeout: 30
@tecmaverick
tecmaverick / Android-Emulator-on-AWS-EC2.txt
Created March 11, 2019 23:11 — forked from atyachin/Android-Emulator-on-AWS-EC2.txt
Installing and running Android Emulator on Amazon AWS EC2 (Ubuntu 16.04)
Steps for installing the Android Emulator from EC2 console:
-----------------------------------------------------------
sudo apt install default-jdk
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d android-sdk
sudo mv android-sdk /opt/
export ANDROID_SDK_ROOT=/opt/android-sdk
echo "export ANDROID_SDK_ROOT=/opt/android-sdk" >> ~/.bashrc
echo "export PATH=$PATH:$ANDROID_SDK_ROOT/tools" >> ~/.bashrc
re-login
{
"requestContext": {
"elb": {
"targetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/lambda-target/abcdefgh"
}
},
"httpMethod": "GET",
"path": "/",
"multiValueQueryStringParameters": {
"key": [
@tecmaverick
tecmaverick / LambdaAPINames
Created September 17, 2018 09:18
CloudTrail Lambda API Names
GetFunctionConfiguration20150331v2
PutFunctionConcurrency20171031
ListDistributionsByLambdaFunction
DeleteFunction20150331
ListVersionsByFunction20150331
CreateFunction20150331
ListFunctions
DeleteFunctionConcurrency20171031
ListFunctions20150331
GetFunction20150331v2
@tecmaverick
tecmaverick / CloudTrail_EventSources
Created September 17, 2018 09:11
SQL Query to list all AWS Event sources
SELECT eventsource
FROM <Replace_With_CloudTrail_Table_Name>
GROUP BY eventsource
@tecmaverick
tecmaverick / ListAWSAPIs
Created September 17, 2018 09:10
List all AWS Service APIs names
import boto3
s = boto3.Session()
with open("aws_service_apis.csv","wt") as f:
for session in s.get_available_services():
client = boto3.client(session)
x = dir(client)
for method_name in x:
if not "__" in method_name and \
not method_name[0] == "_" and \
@tecmaverick
tecmaverick / ListRunningEC2Instances
Last active August 30, 2018 21:52
List all EC2 instances (InstanceID, State, Region) across all AWS regions
#Lists only EC2 instance in running state
aws ec2 describe-regions \
--query 'Regions[].[RegionName]' \
--output text | \
xargs -I {} \
aws ec2 describe-instance-status \
--query "InstanceStatuses[].[InstanceId,InstanceState.Name,AvailabilityZone]" \
--output text \
--region {}
@tecmaverick
tecmaverick / LambdaReport
Created August 30, 2018 07:48
View details (FunctionArn, Memory, Runtime and Timeout) of lambda functions across all regions
aws ec2 describe-regions \
--query 'Regions[?RegionName!=`ap-northeast-3`].[RegionName]' \
--output text | \
xargs -I {} \
aws lambda list-functions \
--query "Functions[].[{FunctionArn:FunctionArn,MemorySize:MemorySize,Runtime:Runtime,Timeout:Timeout}]" \
--output table --region {}
@tecmaverick
tecmaverick / AWSServiceNames
Created August 30, 2018 04:41
View AWS service names to be used for invoking API from postman
#Note for invoking customer created APIGateway endpoint the servicename should be execute-api instead of apigateway
import boto3
s = boto3.Session()
print s.get_available_services()
@tecmaverick
tecmaverick / AWSServiceSupportedRegions
Last active August 30, 2018 04:46
Python boto3 script to view supported regions for an AWS service
#Before executing the script ensure you have the latest version of AWS CLI installed
#pip install awscli --upgrade
import boto3
s = boto3.Session()
print s.get_available_regions("lambda")