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
/** | |
* Available variables: | |
* user - the current user | |
* realm - the current realm | |
* token - the current token | |
* userSession - the current userSession | |
* keycloakSession - the current keycloakSession | |
*/ | |
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
# Install kubectl | |
curl -sLO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl | |
rm -f ./kubectl | |
# install eksctl | |
curl -sLO "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | |
tar xz -C /tmp -f "eksctl_$(uname -s)_amd64.tar.gz" | |
sudo install -o root -g root -m 0755 /tmp/eksctl /usr/local/bin/eksctl | |
rm -f ./"eksctl_$(uname -s)_amd64.tar.gz" |
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
const appLabel = { app: "hello-kubernetes" }; | |
const deployment = { | |
apiVersion: "apps/v1", | |
kind: "Deployment", | |
metadata: { name: "hello-kubernetes" }, | |
spec: { | |
replicas: 3, | |
selector: { matchLabels: appLabel }, | |
template: { |
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 boto3 | |
from time import sleep | |
REGION = 'us-east-1' | |
AMI_IMAGE_ID = 'ami-0fac5486e4cff37f4' | |
INSTANCE_TYPE = 'c5.xlarge' | |
DISK_SIZE_GB = 200 | |
DEVICE_NAME = '/dev/xvda' | |
NAME = 'codeflex-ec2' | |
OWNER = 'codeflex' |
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
fields @timestamp, @message, kubernetes.container_name | |
| filter log_processed.level like "ERROR" | |
| filter kubernetes.namespace_name like "dromedarv2" | |
| stats count(*) as container_name by kubernetes.container_name | |
| limit 2000 | |
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); |
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
#!/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
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"] |
OlderNewer