Skip to content

Instantly share code, notes, and snippets.

@riddhi89
riddhi89 / connect_private_rds.py
Created October 22, 2018 00:32
Connecting to a private AWS RDS instance in python
from sshtunnel import SSHTunnelForwarder
import pymysql
with SSHTunnelForwarder(
('ec2-52-202-194-76.public-ec2-instance.amazonaws.com'),
ssh_username="ec2-user",
ssh_pkey="~/ssh-tunnel-rds.pem",
remote_bind_address=('private-rds-instance.ckfkidfytpr4.us-east-1.rds.amazonaws.com', 3306)
) as tunnel:
print("****SSH Tunnel Established****")
@riddhi89
riddhi89 / connect_private_rds.py
Last active October 23, 2018 04:25
Connecting to a private AWS RDS instance in python
from sshtunnel import SSHTunnelForwarder
import pymysql
with SSHTunnelForwarder(
('ec2-52-202-194-76.public-ec2-instance.amazonaws.com'),
ssh_username="ec2-user",
ssh_pkey="~/ssh-tunnel-rds.pem",
remote_bind_address=('private-rds-instance.ckfkidfytpr4.us-east-1.rds.amazonaws.com', 3306)
) as tunnel:
print("****SSH Tunnel Established****")
@riddhi89
riddhi89 / connect_private_rds.py
Created October 22, 2018 00:36
Connecting to a private AWS RDS instance in python
from sshtunnel import SSHTunnelForwarder
import pymysql
with SSHTunnelForwarder(
('ec2-52-202-194-76.public-ec2-instance.amazonaws.com'),
ssh_username="ec2-user",
ssh_pkey="~/ssh-tunnel-rds.pem",
remote_bind_address=('private-rds-instance.ckfkidfytpr4.us-east-1.rds.amazonaws.com', 3306)
) as tunnel:
print("****SSH Tunnel Established****")
def missing_numbers(numbers: list) -> str:
"""
Returns a comma-separated number/range of numbers which are missing in the specified list
# O(n) solution; n - size of the input list of numbers
"""
i = 0
lnumbers = len(numbers)
result = ''
@riddhi89
riddhi89 / 1.proxy_defaults.json
Last active May 12, 2022 18:05
merge-central-config
{
"Kind": "proxy-defaults",
"Name": "global",
"Mode": "direct",
"Config": {
"local_connect_timeout_ms": 1000,
"handshake_timeout_ms": 10000
}
}
✗ cat catalog_service_register.json
{
"Datacenter": "dc1",
"Node": "synthetic-node1",
"Address": "127.0.0.1",
"TaggedAddresses": {
"lan": "127.0.0.1",
"wan": "10.0.10.10"
},
"NodeMeta": {
@riddhi89
riddhi89 / 1_agent
Created June 2, 2022 18:11
Demo: consul connect envoy cmd changes for agentless
➜ consul connect envoy -proxy-id web-sidecar-proxy -bootstrap
{
"admin": {
"access_log_path": "/dev/null",
"address": {
"socket_address": {
"address": "127.0.0.1",
"port_value": 19000
}
}
@riddhi89
riddhi89 / helm.values
Created November 2, 2022 19:45
sample helm values that work with 1.0.0-beta3 chart
global:
enabled: false
name: consul
datacenter: riddhi-aws-114beta
image: "hashicorp/consul-enterprise:1.14.0-beta1-ent"
acls:
manageSystemACLs: true
bootstrapToken:
secretName: riddhi-aws-114beta-hcp
secretKey: bootstrapToken