Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Hassan Murtaza MrHassanMurtaza

🎯
Focusing
Block or report user

Report or block MrHassanMurtaza

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MrHassanMurtaza
MrHassanMurtaza / aws-codepipeline-executor.py
Last active Jan 10, 2020
AWS CodePipeline Executor Python
View aws-codepipeline-executor.py
import json, os
import boto3
from botocore.exceptions import ClientError
def lambda_handler(event, context):
"""
Lambda Handler
Triggers AWS CodePipeline
:param event: takes event triggered by cloudwatch rule
@MrHassanMurtaza
MrHassanMurtaza / serverless-deploy-iam.json
Created Nov 21, 2019
Serverless Deploy Permissions with SQS as a Trigger
View serverless-deploy-iam.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"apigateway:GET",
"apigateway:POST",
"apigateway:PUT",
@MrHassanMurtaza
MrHassanMurtaza / secret-manager-policy.json
Last active Oct 24, 2019
Secret manager attribute based access control
View secret-manager-policy.json
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action": "secretsmanager:GetSecretValue",
"Resource": "*",
"Condition": {
"secretsmanager:ResourceTag/Project": "${aws:PrincipalTag/Project}"
}
View secret-manager-to-env.js
// 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}`,
View AWSDevOpsExamTips
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 / csv-to-json.js
Last active Aug 17, 2019
Convert CSV to JSON based on Delimeter
View csv-to-json.js
const removeSpaces = (str) => {
return str.replace(/^\s+|\s+$/g, "");
}
const DELIMITER = '|';
const csvJSON = (csv) => {
let lines = csv.split("\n");
@MrHassanMurtaza
MrHassanMurtaza / circleci.yml
Created Jul 24, 2019 — forked from statico/circleci.yml
Node.js 10 + PostgreSQL CircleCI config
View circleci.yml
version: 2
workflows:
version: 2
build:
jobs:
- test
jobs:
test:
@MrHassanMurtaza
MrHassanMurtaza / config.yml
Created Jul 24, 2019 — forked from posva/config.yml
Simple Circle CI 2 config for node/js projects
View config.yml
# 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 / lambda_rds_mysql.js
Last active Jul 9, 2019
Connect Lambda to RDS MySql
View lambda_rds_mysql.js
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 / lambda_function.py
Last active May 27, 2019
Automate Analyzing your IAM Permissions using IAM Access Advisor
View lambda_function.py
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
You can’t perform that action at this time.