Skip to content

Instantly share code, notes, and snippets.

View quixoticmonk's full-sized avatar
🏠
Working from home

Manu Chandrasekhar quixoticmonk

🏠
Working from home
View GitHub Profile
@quixoticmonk
quixoticmonk / LambdaRestapi.js
Created April 1, 2022 16:54
resource policy Restpi
import * as apigateway from '@aws-cdk/aws-apigateway'
import * as iam from '@aws-cdk/aws-iam'
const whitelistedIps = ['8.8.8.8','12.123.124.21']
const apiResourcePolicy = new iam.PolicyDocument({
statements: [
new iam.PolicyStatement({
actions: ['execute-api:Invoke'],
from aws_cdk import (
core as cdk,
aws_rds as rds,
aws_ec2 as ec2,
aws_secretsmanager as secretsmanager
)
class IngressStack(cdk.Stack):
@quixoticmonk
quixoticmonk / scan.py
Created February 11, 2021 18:08 — forked from pgolding/scan.py
scan all elements from a dynamodb table using Python (boto3)
from __future__ import print_function # Python 2/3 compatibility
import boto3
import json
import decimal
from boto3.dynamodb.conditions import Key, Attr
# Helper class to convert a DynamoDB item to JSON.
class DecimalEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, decimal.Decimal):
@quixoticmonk
quixoticmonk / gist:e9ac5864f90dc47a9209b43b63419914
Last active September 17, 2020 02:52
sample_sam_template
---
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: AWS SAM template with API defined
Resources:
ApiGatewayApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
@quixoticmonk
quixoticmonk / Jenkinsfile
Created May 14, 2020 01:46 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, kubernetes templates, shared volumes, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, Docker containers, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage c…
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(label: label, yaml: """
spec:
containers:
- name: mvn
image: maven:3.3.9-jdk-8-alpine