Skip to content

Instantly share code, notes, and snippets.

View tecmaverick's full-sized avatar

AbrahamJP tecmaverick

View GitHub Profile
@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 / 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 / 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 / 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 / LambdaAPINames
Created September 17, 2018 09:18
CloudTrail Lambda API Names
GetFunctionConfiguration20150331v2
PutFunctionConcurrency20171031
ListDistributionsByLambdaFunction
DeleteFunction20150331
ListVersionsByFunction20150331
CreateFunction20150331
ListFunctions
DeleteFunctionConcurrency20171031
ListFunctions20150331
GetFunction20150331v2
{
"requestContext": {
"elb": {
"targetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/lambda-target/abcdefgh"
}
},
"httpMethod": "GET",
"path": "/",
"multiValueQueryStringParameters": {
"key": [
@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
@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 / LambdaListFunction.js
Last active May 15, 2020 13:59
Lambda Function to list all lambda functions. Using marker to page the results
const AWS = require('aws-sdk')
const lam = new AWS.Lambda()
async function getLambdaFuntions(marker)
{
let promise = new Promise(function(resolve, reject) {
var records = [];
var result = {"records":records,"marker":marker}
var params = {MaxItems: 100, FunctionVersion: 'ALL'}
@tecmaverick
tecmaverick / Lambda_CLI_Commands.txt
Last active May 15, 2020 03:37
Lambda CLI Commands
#**********************************************************
#Upload binary file via AWS CLI v2
data=$(base64 < replace_with_filename.png)
aws lambda invoke \
--function-name replace_with_function_name \
--payload "{\"test\" : \"$data\"}" \
--cli-binary-format raw-in-base64-out \
output.txt
#---------------------------------------------------------