Skip to content

Instantly share code, notes, and snippets.

@farhad-taran
farhad-taran / README.md
Last active September 16, 2024 08:36
Useful Lambda cloudwatch log insights queries

1 - Find all logs for a given request ID or X-Ray trace ID

fields @timestamp, @message
| filter @message like /REQUEST_ID_GOES_HERE/

2 - Find 50 most recent errors

filter @message like /(?i)(Exception|error|fail)/
| fields @timestamp, @message 
@Miraculix200
Miraculix200 / gist:e0fc7c02e7911d840f3abe3c7cdae6f9
Created October 31, 2022 18:52
Dreambooth on SageMaker Studio Lab (save as .ipynb notebook)
This file has been truncated, but you can view the full file.
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"cellView": "form",
"colab": {
"base_uri": "https://localhost:8080/"
},
@dhavaln
dhavaln / IAMCredentials.json
Created December 22, 2018 11:06 — forked from ServerlessBot/IAMCredentials.json
Minimum credential set for Serverless Framework
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
@evanderkoogh
evanderkoogh / index.js
Created August 24, 2018 05:18
Add and/or overwrite values in a DynamoDB table with the Document Client
const AWS = require('aws-sdk')
const docClient = new AWS.DynamoDB.DocumentClient()
const mapKeys = (input, transform) => {
const output = {}
Object.keys(input).forEach((key, index, array) => {
output[transform(key, index, array)] = input[key]
})
return output
@tpai
tpai / ImageProcess.js
Created January 4, 2018 04:32
Lambda function for create thumbnail.
// dependencies
var async = require('async');
var path = require('path');
var AWS = require('aws-sdk');
var gm = require('gm').subClass({
imageMagick: true
});
var util = require('util');
var LambdaWatermark = require('lambda-watermark');
@tpai
tpai / auto-scaling.md
Last active February 24, 2021 14:38
cheatsheet for aws ecs

Auto Scaling Launch Config

  • Amazon ECS Optimized AMI: ami-b4ae1dd7
  • Instance Type: t2.small

Config Details

  • Name: [CONFIG_NAME]
  • IAM role: fever_ecs
  • User data: As text

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@BurlesonBrad
BurlesonBrad / functions.php
Created March 10, 2016 21:34 — forked from TimBHowe/functions.php
Reduce or remove WooCommerce 2.5 minimum password strength requirement for creating a user account. Warning: Use at your own risk.
<?php
/**
*Reduce the strength requirement on the woocommerce password.
*
* Strength Settings
* 3 = Strong (default)
* 2 = Medium
* 1 = Weak
* 0 = Very Weak / Anything
*/
@jmshal
jmshal / create-multi-host-swarm-digitalocean.sh
Last active March 16, 2023 13:22
Setup a Docker Swarm multi-host cluster on DigitalOcean
docker-machine create \
--driver=digitalocean \
--digitalocean-access-token=$DO_TOKEN \
--digitalocean-size=512mb \
--digitalocean-region=nyc3 \
--digitalocean-private-networking=true \
--digitalocean-image=ubuntu-15-04-x64 \
docker-swarm-kv-store
docker $(docker-machine config docker-swarm-kv-store) run -d \
@DocX
DocX / README.md
Last active September 5, 2023 12:58
Connect to bash inside running ECS container by cluster and service name