https://github.com/riferrei/aws-elasticache-with-bastion-host
AWS ElastiCache with a Bastion Host using Terraform
https://github.com/riferrei/aws-elasticache-with-bastion-host
aws bastion elasticache host infrastructure-as-a-code redis terraform
Last synced: 8 months ago
JSON representation
AWS ElastiCache with a Bastion Host using Terraform
- Host: GitHub
- URL: https://github.com/riferrei/aws-elasticache-with-bastion-host
- Owner: riferrei
- License: apache-2.0
- Created: 2020-03-08T22:05:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-09T12:58:08.000Z (over 5 years ago)
- Last Synced: 2025-01-02T21:43:32.826Z (9 months ago)
- Topics: aws, bastion, elasticache, host, infrastructure-as-a-code, redis, terraform
- Language: HCL
- Homepage:
- Size: 9.77 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AWS ElastiCache with a Bastion Host using Terraform
This example show how to create a bastion host for a Redis server created on AWS using ElastiCache. Using a bastion host along with your Redis server is useful for troubleshooting purposes, where developers can easily access the Redis server otherwise only accessible by any service _running in the same private subnet_ of Redis. To allow access to Redis, the bastion host created has the `redis-cli` CLI installed by default.
## Steps to use this example:
### 1 - Create a variables file for AWS
```bash
mv variables.auto.tfvars.example variables.auto.tfvars
```### 2 - Provide the AWS configuration
```bash
aws_access_key = ""
aws_secret_key = ""
aws_region = ""
```### 3 - Create resources with Terraform
```bash
terraform init
terraform plan
terraform apply
```### 4 - SSH to the Bastion host
```bash
ssh ec2-user@ -i cert.pem
```The bastion host public ip will be shown after Terraform finishes the creation of the resources using the outputs instruction. To force Terraform to show the output again, just execute `terraform output`.
### 5 - Access the Redis server
```bash
redis-cli -h
```The Redis cluster endpoint will be provided within the bastion host. To retrieve that, just inspect the `/etc/hosts` file.
## License
[Apache 2.0 License](./LICENSE).