Skip to content

Instantly share code, notes, and snippets.

View chinchalinchin's full-sized avatar

Grant Moore chinchalinchin

View GitHub Profile
@chinchalinchin
chinchalinchin / lambda-template.yml
Last active January 22, 2023 14:53
CloudFormation Template - AWS Lambda With ECR, Secrets and VPC access
Description: A stack containing resources for an AWS Serverless Lambda function deployed through an AWS ECR. The Lambda will be given a role that grants it permission to access resources in a VPC. The IDs of the security group and subnet of the VPC resource must be specified as parameters. An optional parameter allows the application name to be set so resources will be tagged appropriately. In addition, secrets are delivered to the Lambda environment. These secrets must exist in the SecretManager store before this template can be spun up.
Parameters:
applicationName:
Type: String
Default: my-lambdas
Description: Name of the application
securityGroupID:
Type: String
Description: ID of the security group allowing ingress into the VPC resource Lambda is accessing.
@chinchalinchin
chinchalinchin / arg-parse.sh
Last active October 21, 2023 05:18
BASH script to parse command line arguments
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
SCRIPT_NAME="arg-parse"
SCRIPT_DES=$'pass in arguments with \e[3m./scripts/arg-parse --arg1 this --arg2 that\e[0m'
function log(){
echo -e "\e[92m$(date +"%r")\e[0m: \e[4;32m$SCRIPT_NAME\e[0m : >> $1"
}