Skip to content

Instantly share code, notes, and snippets.

Sébastien Stormacq sebsto

View GitHub Profile
sebsto / gist:19b99f1fa1f32cae5d00
Created Aug 8, 2014
Install Maven with Yum on Amazon Linux
View gist:19b99f1fa1f32cae5d00
sudo wget -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
mvn --version
sebsto / code-stack.ts
Last active Jun 8, 2020
CDK Create EC2 instace in private subnet. Install Nginx.
View code-stack.ts
import ec2 = require('@aws-cdk/aws-ec2');
import cdk = require('@aws-cdk/core');
import { Fn, Tag, Resource } from '@aws-cdk/core';
import { AmazonLinuxImage, UserData, InstanceType } from '@aws-cdk/aws-ec2';
import { Role, ServicePrincipal, ManagedPolicy, CfnInstanceProfile } from '@aws-cdk/aws-iam'
* Create my own Ec2 resource and Ec2 props as these are not yet defined in CDK
* These classes abstract low level details from CloudFormation
View gist:a81db362d06f5d7b3afc65b4c19048a3
// specific for my Data Model to unblock me.
// only tested on queries.
➜ Landmarks diff -c /Users/stormacq/Documents/amazon/code/amplify/amplify-ios//Amplify/Categories/DataStore/Model/Schema/ModelSchema+Definition.swift ./Pods/Amplify/Amplify/Categories/DataStore/Model/Schema/ModelSchema+Definition.swift
*** /Users/stormacq/Documents/amazon/code/amplify/amplify-ios//Amplify/Categories/DataStore/Model/Schema/ModelSchema+Definition.swift Sat Jun 6 08:29:27 2020
--- ./Pods/Amplify/Amplify/Categories/DataStore/Model/Schema/ModelSchema+Definition.swift Sat Jun 6 08:49:47 2020
*** 31,36 ****
--- 31,45 ----
return false
sebsto / gist:6441df09e97c4cbbd22b8ba313b8d642
Last active May 4, 2020
Amazon Linux 2 first boot on Virtual Box
View gist:6441df09e97c4cbbd22b8ba313b8d642
# Download the VDI from
# Doc is at
# Be sure you have config/meta-data and config/user-data ready as per the below
# change ec2-user's password to your password
$ cat config/meta-data
local-hostname: amazonlinux.onprem
# eth0 is the default network interface enabled in the image. You can configure
sebsto /
Created Apr 28, 2020
Delete Amlify Console App after `amplify delete`
APP_ID=$(aws amplify list-apps --query 'apps[? ! contains(keys(@), `productionBranch`) == `true`].[appId]' --output text )
echo $APP_ID | while read appid
aws amplify delete-app --app-id $appid
View gist:71c5e7765ca926f374b766d8e6fb37ff
aws ec2 get-console-screenshot --instance-id ID --query "ImageData" --output text > f; cat f | base64 -D > screen.jpg
sebsto / gist:2ce59d80a3b5d30bb1ee456e96bf0fb0
Last active Mar 28, 2020
Redshift Materialized View Demo
View gist:2ce59d80a3b5d30bb1ee456e96bf0fb0
drop table store;
drop table sales;
drop materialized view city_sales;
CREATE TABLE "sales" (
"id" int PRIMARY KEY,
"item" varchar,
sebsto / gist:9a958ff1c761b8c7c90d
Last active Dec 16, 2019
Create IAM User and Attach a Policy using Boto and JSON
View gist:9a958ff1c761b8c7c90d
import json, boto
# Connect to IAM with boto
iam = boto.connect_iam(ACCESS_KEY, SECRET_KEY)
# Create user
user_response = iam.create_user('aws-user')
# Create Policy
policy = { 'Version' : '2012-10-17'}
sebsto /
Created Nov 21, 2019
Delete Log groups
for NAME in $(aws logs describe-log-groups | jq -r .logGroups[].logGroupName | grep amplifynotes)
aws logs delete-log-group --log-group-name $NAME
sebsto /
Created Nov 15, 2019
Amazon S3 - List all your buckets (aka 'ls' command)
import boto3
s3 = boto3.resource('s3')
for bucket in s3.buckets.all():
You can’t perform that action at this time.