Skip to content

Instantly share code, notes, and snippets.

View MrHassanMurtaza's full-sized avatar
🎯
Focusing

Hassan Murtaza MrHassanMurtaza

🎯
Focusing
View GitHub Profile
@MrHassanMurtaza
MrHassanMurtaza / config.xml
Created August 28, 2018 07:29 — forked from g0t4/config.xml
Module 2 - What am I? Get this job loaded into Jenkins and running, there are two problems you'll encounter. Raw
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.plugins.git.GitSCM" plugin="git@2.5.2">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
@MrHassanMurtaza
MrHassanMurtaza / user-data.sh
Created February 6, 2019 11:25 — forked from codeinthehole/user-data.sh
Get the value of an EC2 instance's tag
#!/usr/bin/env bash
#
# Get the value of a tag for a running EC2 instance.
#
# This can be useful within bootstrapping scripts ("user-data").
#
# Note the EC3 instance needs to have an IAM role that lets it read tags. The policy
# JSON for this looks like:
#
# {
@MrHassanMurtaza
MrHassanMurtaza / get_iam_client.py
Last active May 27, 2019 20:38
Lambda IAM Policy for Access Advisor and SES
def get_iam_client():
"""
Get identity and access management client
"""
return boto3.client('iam')
@MrHassanMurtaza
MrHassanMurtaza / lambda_function.py
Last active December 15, 2020 09:32
Automate Analyzing your IAM Permissions using IAM Access Advisor
import boto3
from botocore.exceptions import ClientError
from datetime import datetime, timezone
import traceback
from time import sleep
RECIPIENTS = ["recipient_user@abc.com"]
SENDER = "John Doe <johndoe@abc.com>"
LAST_ACCESS_THRESHOLD = 90
@MrHassanMurtaza
MrHassanMurtaza / lambda_rds_mysql.js
Last active July 9, 2019 21:50
Connect Lambda to RDS MySql
const mysql = require('mysql');
var config = require('./config.json');
exports.handler = function(event, context, callback) {
var pool = mysql.createPool({
host : config.dbhost,
user : config.dbuser,
password : config.dbpassword,
@MrHassanMurtaza
MrHassanMurtaza / config.yml
Created July 24, 2019 11:41 — forked from posva/config.yml
Simple Circle CI 2 config for node/js projects
# Javascript Node 8 simple CircleCI 2.0 configuration file
# Eduardo San Martin Morote
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
# Put this file in a .circleci/ folder
version: 2
jobs:
build:
docker:
@MrHassanMurtaza
MrHassanMurtaza / circleci.yml
Created July 24, 2019 11:42 — forked from statico/circleci.yml
Node.js 10 + PostgreSQL CircleCI config
version: 2
workflows:
version: 2
build:
jobs:
- test
jobs:
test:
@MrHassanMurtaza
MrHassanMurtaza / csv-to-json.js
Last active August 17, 2019 22:05
Convert CSV to JSON based on Delimeter
const removeSpaces = (str) => {
return str.replace(/^\s+|\s+$/g, "");
}
const DELIMITER = '|';
const csvJSON = (csv) => {
let lines = csv.split("\n");
Autoscaling.
◾Understand autoscaling inside and out.
◾Make sure you know the differences between deploying with and without Cloudformation (as there are some deployment methods you can do with Cloudformation that you can’t without) and the command or JSON syntax to perform them.
◾Understand lifecycle hooks and the autoscaling stages they run in
◾Understand launch configurations and how they work and are updated (hint: You must replace them)
◾Understand why you may need to place an instance into STANDBY state
•Elastic Beanstalk.
◾You’ll need to know this to an advanced level.
◾Understand what stacks Beanstalk supports natively and how you would deploy a stack it doesn’t (hint: Use Docker).
@MrHassanMurtaza
MrHassanMurtaza / secret-manager-to-env.js
Created October 17, 2019 10:46
secret-manager-to-env
// Use this code snippet in your app.
// If you need more information about configurations or implementing the sample code, visit the AWS docs:
// https://aws.amazon.com/developers/getting-started/nodejs/
// Load the AWS SDK
DEPLOYMENT_GROUP_NAME = process.env.DEPLOYMENT_GROUP_NAME
var AWS = require('aws-sdk'),
region = "us-west-2",
secretName = `${DEPLOYMENT_GROUP_NAME}`,