Skip to content

Instantly share code, notes, and snippets.

View okram999's full-sized avatar

Niris Okram okram999

View GitHub Profile
@okram999
okram999 / Adding a user or granting access
Created July 30, 2019 14:14
Adding a user or granting access
Create new user: CREATE USER <userid> WITH PASSWORD <password>;
User should change password after login: ALTER ROLE your_userid WITH PASSWORD 'new_password';
Create a role: CREATE ROLE < Role Name>
Grant PRIVILEGES to Role: GRANT SELECT ON all tables in schema public to <role_name>
Assign role to user: GRANT <Role Name> TO <User Id>;
Revoke permissions: REVOKE <userId> FROM <role name>;
@okram999
okram999 / nginx-ssl-chain
Created June 20, 2019 20:08
nginx-ssl-chain
site-cert
AddTrustExternalCARoot.crt
TrustedSecureCertificateAuth5.crt
UserTrustRSAAddTrustCA.crt
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' cert-name.pem
@okram999
okram999 / things to optimise
Created May 9, 2019 03:58
things to optimise
use endpoints for s3 and ECR
Add autoscaling in CFT
Use the secret manager
ABE
[ ] 0040_sourcedbreference_environment
[ ] 0041_employee_source_database
[ ] 0042_auto_20190326_1849
[ ] 0043_auto_20190326_1907
[ ] 0044_auto_20190326_1916
[ ] 0045_auto_20190326_1921
[ ] 0046_auto_20190326_1928
[ ] 0047_auto_20190326_1933
# original source: https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/curator.html
import boto3
from requests_aws4auth import AWS4Auth
from elasticsearch import Elasticsearch, RequestsHttpConnection
import curator
host = 'vpc-ava-uat2-es-6fv4pfs3r6vvhdf2gadimydigi.us-east-1.es.amazonaws.com'
region = 'us-east-1'
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "ecs-tasks.amazonaws.com"
},
"Action": "sts:AssumeRole"
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"secretsmanager:Describe*",
"secretsmanager:List*",
"secretsmanager:Get*"
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"secretsmanager:Describe*",
"secretsmanager:Get*",
"secretsmanager:List*"
],
node('master') {
try{
//delete workspace
deleteDir()
/*
echo the parameters that are being passed to the job
*/
println "Validation of the metadata set as: $validate"