Skip to content
Using Amazon ElastiCache for Redis as a Session Cache-Store - Part 2

This is the second and final part of our series on Using Amazon ElastiCache for Redis as a Session Cache-Store. The first article discussed what technologies we will use, the prerequisites and architecture overview, and the configuration and setup process.

In this part two and final article, we will be working on these tasks.

  • Configure access to Amazon EKS Cluster
  • Build and deploy our Docker image to Amazon ECR
  • Deploy supporting services to Kubernetes
  • Deploy Python Flask Color application to Kubernetes
  • Demonstrate how Session Cache works with our Python Flask Color application and Amazon ElastiCache
  • Clean up apps and infrastructure

You can access all of the code used in my GitHub Repository.

All the commands are run from the root directory of the GitHub repo.

No alt text provided for this image

Configure access to Amazon EKS Cluster

Amazon EKS Cluster details can be extracted from terraform output or from the AWS Console to get the name of the cluster. This following command can be used to update the kubeconfig in your local machine where you run kubectl commands to interact with your EKS Cluster.

AWS_REGION=$(terraform output -raw aws_region)

EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name)

aws eks --region $AWS_REGION update-kubeconfig --name $EKS_CLUSTER_NAME

Results of configuring kubeconfig.

No alt text provided for this image

Build the Docker image

Set the variables needed to build and push your Docker image. Navigate to the root of the directory of the GitHub repo and run the following commands:

AWS_REGION=$(terraform output -raw aws_region)

ECR_REPO=$(terraform output -raw ecr_repo_url)

To build the Docker image, run the following command:

docker build --platform linux/amd64 --no-cache --pull -t ${ECR_REPO}:latest ./color

Push the Docker image to Amazon ECR

To push the Docker image to Amazon ECR, authenticate to your private Amazon ECR registry. To do this, run the following command:

aws ecr get-login-password --region $AWS_REGION 
                    

Related Articles

Inter-Region WireGuard VPN in AWS

Read more

Making PDFs Searchable Using AWS Textract and CloudSearch

Read more

Slack AI Bot with AWS Bedrock Part 2

Read more

Contact Us

Achieve a competitive advantage through BSC data analytics and cloud solutions.

Contact Us