Skip to content

Instantly share code, notes, and snippets.

View Gershon-A's full-sized avatar

Gershon Alvais Gershon-A

View GitHub Profile
@Gershon-A
Gershon-A / TestProject-Agent-k8s Readme
Last active August 6, 2022 09:58
TestProject Agent with headless chrome and firefox on kubernetes
### Tested on
GKE Version 1.18.12-gke.1210
EKS Version 1.19
With TestProject Agent => v0.66.4
This yaml snippet spins up 3 deployments:
@Gershon-A
Gershon-A / codebuild_example1.txt
Last active November 23, 2021 07:49
AWS CodeBuild grep and sed yaml file
Example of replacing "tag" in helm values.yaml file in CodeBuild
```
# VALUE for tag in values.yaml is tag: "121212"
# NEW_TAG = 131313
# YAML_FILE = values.yaml
- "OLD_TAG=$(cat $YAML_FILE | grep -P 'tag:' | awk -F: '{ print $2 }' | sed 's/[\",]//g' | sed -e 's/^[[:space:]]*//')"
- echo OLD_TAG=$OLD_TAG
- sed -i "s|${OLD_TAG}|${NEW_TAG}|g" $YAML_FILE
- cat $YAML_FILE | grep tag
```
@Gershon-A
Gershon-A / codebuild_example2.txt
Created November 23, 2021 07:51
AWS CodeBuild create new file - id_rsa
```
- mkdir -p ~/.ssh
- |
cat <<'EOF' >> /root/.ssh/id_rsa
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
.......
Ql5XBc4URDIP4ttLefoiQqTlQ44jhsvNQew0Y6nWW8FGbAboJ8aBNKtmREEXBGTImds5dg
2Vtten/iK+Qh0AAAAabWFyYXRzdHJlbGV0c0BNQlAwMDIubG9jYWwB
-----END OPENSSH PRIVATE KEY-----
@Gershon-A
Gershon-A / docker-compose.yml
Created August 6, 2022 09:59
Docker compose to create postgrest, swagger and pgadmin
# docker-compose.yml
version: '3'
services:
server:
image: postgrest/postgrest
ports:
- "3000:3000"
environment:
PGRST_DB_URI: postgres://app_user:password@db:5432/app_db
@Gershon-A
Gershon-A / elasticcache.yaml
Created November 28, 2022 07:49
AWS Cloud Formation template for high availability (MultiAZ) ElasticCache Redis cluster, scheduled automatic backup, special user and user group for authorization, Encryption in transit (tls required), disk encryption
AWSTemplateFormatVersion: "2010-09-09"
Description: Setup ElasticCache.
Parameters:
PrimaryAvailabilityZone:
Description: Primary Availability Zone
Type: String
Default: "us-east-1a"
ReplicaAvailabilityZone1:
@Gershon-A
Gershon-A / vpc.yaml
Created December 16, 2022 12:00
Amazon EKS VPC - Private and Public subnets
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Amazon EKS VPC - Private and Public subnets'
Parameters:
usecase:
Description: Which account are you deploying in?
Type: String
AllowedValues:
- 'prod'
@Gershon-A
Gershon-A / Readme.md
Created May 2, 2023 17:24
Kpng wildcard in route path

\d+ - only numbers .+ - any value
For example:
Api path like /v1/projects/{project-key}/test-runs/{test-run-key}/steps/{step-number}/attachments
in kong
/v1/projects/.+/test-runs/.+/steps/\d+/attachments$

@Gershon-A
Gershon-A / APIGW-NLB.yaml
Last active May 30, 2023 13:12
REST API using Amazon API Gateway with a VPC Link integration API Gateway and a DomainName record set group using AWS Route53.
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Serverless patterns - Amazon API Gateway REST API with VPC Link integration
Parameters:
usecase:
Description: What environment should be deployed
Type: String
AllowedValues:
- "prod"
@Gershon-A
Gershon-A / GlobalAccelerator.yaml
Last active December 11, 2023 11:33
CloudFormation template for Global Accelerator with Listeners
AWSTemplateFormatVersion: '2010-09-09'
Description: >-
CloudFormation template for Global Accelerator with Listeners port 443 and Endpoints to exist ALB.
Exist ALB Arn is fettched by Lambda.
Finaly, we updating Dns recoord for domain to point to the Global Accelerator.
# ------------------------------------------------------------#
# Input Parameters
# ------------------------------------------------------------#
Parameters:
@Gershon-A
Gershon-A / show_obgects_moved_to_glacier.sh
Last active January 31, 2024 12:04
This script lists all objects in a specified AWS S3 bucket that were moved to the GLACIER storage class within a specified number of days ago.
#!/bin/bash
# This script lists all objects in a specified AWS S3 bucket that were moved to the GLACIER storage class within a specified number of days ago.
# Usage: ./show_obgects_moved_to_glacier.sh your-bucket-name aws-profile days_ago
# Get the arguments
bucket="$1"
profile="$2"
days_ago="$3"
# Set the page size for pagination