Welcome to the scripts/ directory, designed to house scripts that facilitate various infrastructure tasks, including connecting to AWS Bastion hosts, tunneling into EKS Clusters, and generating kubeconfig
files for those clusters. These tools are crafted to streamline your interactions with cloud resources, ensuring both efficiency and security in your operations.
This directory currently includes the following key scripts:
-
connect-to-core-networking-bastion-host.sh
:- This script connects to an AWS Bastion host within a specified environment. You can use it to either establish a direct connection or create a tunnel through the bastion host to another target.
-
connect-to-services-platform-eks-cluster.sh
:- This script is specifically designed to create a tunnel through the bastion host directly to an EKS Cluster. This tunnel is crucial for securely interacting with the EKS Cluster using
kubectl
via a local port.
- This script is specifically designed to create a tunnel through the bastion host directly to an EKS Cluster. This tunnel is crucial for securely interacting with the EKS Cluster using
-
generate-services-platform-eks-kubeconfig.sh
:- This script generates a
kubeconfig
file tailored for the EKS Cluster in a specified environment, configured to work with a local tunnel. It also sets up an.envrc
file in the root of the repository to automatically set theKUBECONFIG
environment variable usingdirenv
.
- This script generates a
For detailed information on how to use each script, including all available options, please run the script with the --help
flag. This will provide you with comprehensive usage instructions.
Simple Example (Direct Connection):
./connect-to-core-networking-bastion-host.sh --environment=sandbox
This command connects directly to the bastion host in the sandbox
environment.
Advanced Example (With Tunnel):
./connect-to-core-networking-bastion-host.sh --environment=staging --tunnel=8080:remote.host:80
This command creates a tunnel from port 8080
on your local machine to port 80
on remote.host
through the bastion host in the staging
environment.
Example (Create Tunnel to EKS Cluster):
./connect-to-services-platform-eks-cluster.sh --environment=sandbox
This command sets up a tunnel through the bastion host to the EKS Cluster in the sandbox
environment, allowing you to use kubectl
via http://localhost:${tunnel_local_port}
.
Example (Generate Kubeconfig for EKS Cluster):
./generate-services-platform-eks-kubeconfig.sh --environment=sandbox
This command generates a kubeconfig
file for the EKS Cluster in the sandbox
environment, configured to work with a local tunnel. It also sets up an .envrc
file in the root of the repository to automatically set the KUBECONFIG
environment variable.
This repository is built to be scalable and can easily accommodate new scripts. To add a new script:
- Create your script in a similar format to the existing ones.
- Document it within this README, including a brief description and example usage.
- Ensure consistency in option flags and usage instructions for ease of use across different scripts.
If you have improvements, fixes, or new scripts to add, feel free to submit a pull request. Ensure that your changes are well-documented and maintain the existing style and structure of this repository.