import boto3
AWS_REGION = "us-east-1"
sns_client = boto3.client("sns", region_name=AWS_REGION)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import config. | |
# You can change the default config with `make cnf="config_special.env" build` | |
cnf ?= config.env | |
include $(cnf) | |
export $(shell sed 's/=.*//' $(cnf)) | |
# import deploy config | |
# You can change the default deploy config with `make cnf="deploy_special.env" release` | |
dpl ?= deploy.env | |
include $(dpl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -Eeo pipefail | |
function check_sig() { | |
gpg --import ./ci/synced/aws-cli/aws_pub_key.txt \ | |
&& curl -o awscliv2.sig https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip.sig \ | |
&& gpg --verify awscliv2.sig awscliv2.zip \ | |
&& echo "GOOD" || echo "BAD" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Delete a namespace that get stuck | |
> NS=`kubectl get ns |grep Terminating | awk 'NR==1 {print $1}'` && kubectl get namespace "$NS" -o json | tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" | kubectl replace --raw /api/v1/namespaces/$NS/finalize -f - | |
## Delete a Pod that get stock | |
# Create the namespace if not exist | |
> kubectl create namespace <namespace_name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### | |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of this | |
# software and associated documentation files (the "Software"), to deal in the Software | |
# without restriction, including without limitation the rights to use, copy, modify, | |
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | |
# permit persons to whom the Software is furnished to do so. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROLE_ARN="arn:aws:iam::XXXXXXXXXXXX:role/developer | |
USERNAME="developer" | |
ROLE=" - rolearn: ${ROLE_ARN}\n username: ${USERNAME}\n groups:\n - system:masters" | |
kubectl get -n kube-system configmap/aws-auth -o yaml | awk "/mapRoles: \|/{print;print \"$ROLE\";next}1" > /tmp/aws-auth-patch.yml | |
kubectl patch configmap/aws-auth -n kube-system --patch "$(cat /tmp/aws-auth-patch.yml)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assume_lookup_role(zone, account_id): | |
DNS_DELEGATION_READONLY_ROLE = ( | |
f"arn:aws:iam::{account_id}:role/dns-delegation-readonly-role" | |
) | |
sts = boto3.client("sts") | |
credentials = sts.assume_role( | |
RoleArn=DNS_DELEGATION_READONLY_ROLE, | |
RoleSessionName=f"DnsDelegationLookup-{zone}", | |
)["Credentials"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import os | |
import boto3 | |
import csv | |
from datetime import datetime, timezone | |
s3_resource = boto3.resource('s3') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The ternary operator is a for of syntatic sugar for an inline if/else | |
#Javascript: | |
const color = "blue" | |
console.log(color === "blue" ? "Show blue" : "Show red") | |
//output: Show blue | |
#Python | |
color = "blue" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## This should be placed inside the test section in your postman | |
# It will provide the Token retrieved as Environment variable | |
var jsonData = pm.response.json(); | |
token = jsonData.access_token | |
console.log(token) | |
pm.environment.set("TOKEN", token); |
NewerOlder