Skip to content

Instantly share code, notes, and snippets.

View eahefnawy's full-sized avatar

Eslam λ Hefnawy eahefnawy

View GitHub Profile

Implement a CLI tool that could deploy an AWS Resources Stack (example below) as fast as possible:

myTable:
  resource: dynamodb
  params:
    name: my-table

myBucket:
{
"resource": "/users/list",
"path": "/users/list",
"httpMethod": "GET",
"headers": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-us",
"CloudFront-Forwarded-Proto": "https",
"CloudFront-Is-Desktop-Viewer": "true",
{
"Records": [
{
"eventID": "50204b3941c11bacb80b7db0e8b783a5",
"eventName": "MODIFY",
"eventVersion": "1.1",
"eventSource": "aws:dynamodb",
"awsRegion": "us-east-1",
"dynamodb": {
"ApproximateCreationDateTime": 1475580840,
@eahefnawy
eahefnawy / apig.json
Created September 27, 2016 18:28
AWS Event Sources Data Structures. Useful for mocking.
{
"body": {},
"method": "GET",
"principalId": "",
"stage": "dev",
"headers": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-us",
"CloudFront-Forwarded-Proto": "https",
'use strict';
require('shelljs/global');
const CLI = require('./classes/CLI');
const Config = require('./classes/Config');
const YamlParser = require('./classes/YamlParser');
const PluginManager = require('./classes/PluginManager');
const Utils = require('./classes/Utils');
const Service = require('./classes/Service');
@eahefnawy
eahefnawy / populateVariables.js
Created December 28, 2015 16:04
Utility Function to populate Serverless project JSON variables
/*
- variable names are provided with the ${someVar} syntax. Ex. {projectName: '${someVar}'}
- variables can be of any type, but since they're referenced in JSON, variable names should always be in string quotes:
Ex. {projectName: '${someVar}'} - someVar can be an obj, or array...etc
- you can provide more than one variable in a string. Ex. {projectName: '${firstName}-${lastName}-project'}
- we get the value of the variable based on stage/region provided. If both are provided, we'll get the region specific value,
if only stage is provided, we'll get the stage specific value, if none is provided, we'll get the private or public specific value (depending on the type property of the option obj)
*/
'use strict';