Skip to content

Instantly share code, notes, and snippets.

View ardeshir's full-sized avatar
🎯
Focusing

sepahsalar ardeshir

🎯
Focusing
View GitHub Profile
@ardeshir
ardeshir / setup.sh
Created May 14, 2018 16:31 — forked from mlabouardy/setup.sh
Setup CloudWatch alarm with AWS CLI
aws cloudwatch put-metric-alarm --region us-east-1
--alarm-name "HighCPUUtilization"
--alarm-description "High CPU Utilization"
--actions-enabled
--alarm-actions "TOPIC_ARN"
--metric-name "CPUUtilization"
--namespace AWS/EC2 --statistic "Average"
--dimensions "Name=InstanceName,Value=demo"
--period 60
--evaluation-periods 60

Frontend Masters: AWS for Frontend Engineers

You should have the following completed on your computer before the workshop:

  • Install the AWS CLI.
  • Have Node.js installed on your system. (Recommended: Use nvm.)
    • Install yarn with brew install yarn.
  • Create an AWS account. (This will require a valid credit card.)
  • Create a Travis CI account. (This should be as simple as logging in via GitHub).
FROM amazonlinux:latest
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
RUN export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] \
&& \. "$NVM_DIR/nvm.sh" && [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" \
&& nvm install v6.10.0 \
&& npm install serverless -g \
&& npm install newman -g \
&& npm install serverless-localstack -g
@ardeshir
ardeshir / serverless.yml
Created March 18, 2019 18:33 — forked from OneMuppet/serverless.yml
AWS API Gateway content compression
service:
name: compress-content-tutorial
plugins:
- serverless-api-compression
- serverless-webpack
- serverless-offline
provider:
name: aws
@ardeshir
ardeshir / lambda-basic-auth.js
Created June 11, 2019 19:25 — forked from lmakarov/lambda-basic-auth.js
Basic HTTP Authentication for CloudFront with Lambda@Edge
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'user';
const authPass = 'pass';
@ardeshir
ardeshir / lambda-basic-auth.js
Created June 11, 2019 19:25 — forked from lmakarov/lambda-basic-auth.js
Basic HTTP Authentication for CloudFront with Lambda@Edge
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'user';
const authPass = 'pass';
@ardeshir
ardeshir / clean_old_lambda_versions.py
Created October 9, 2019 16:27 — forked from tobywf/clean_old_lambda_versions.py
A quick script to remove old AWS Lambda function versions
from __future__ import absolute_import, print_function, unicode_literals
import boto3
def clean_old_lambda_versions():
client = boto3.client('lambda')
functions = client.list_functions()['Functions']
for function in functions:
versions = client.list_versions_by_function(FunctionName=function['FunctionArn'])['Versions']
for version in versions:
@ardeshir
ardeshir / ssm_parameter.go
Created December 13, 2019 04:43 — forked from miguelmota/ssm_parameter.go
AWS SSM Go SDK parameter store example
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ssm"
)
@ardeshir
ardeshir / Force_MFA
Created December 30, 2022 15:23 — forked from TJM/Force_MFA
Force Multi-Factor Authentication (MFA) on AWS IAM Accounts
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAllUsersToListAccounts",
"Effect": "Allow",
"Action": [
"iam:ListAccountAliases",
"iam:ListUsers",
"iam:GetAccountSummary"
@ardeshir
ardeshir / audit-on-push.yml
Created January 30, 2023 00:35 — forked from LukeMathWalker/audit.yml
GitHub Actions - Rust setup
name: Security audit
on:
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
jobs:
security_audit:
runs-on: ubuntu-latest
steps: