Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Elastic Kubernetes Service on AWS

You're reading from   Mastering Elastic Kubernetes Service on AWS Deploy and manage EKS clusters to support cloud-native applications in AWS

Arrow left icon
Product type Paperback
Published in Jul 2023
Publisher Packt
ISBN-13 9781803231211
Length 448 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Yang-Xin Cao Yang-Xin Cao
Author Profile Icon Yang-Xin Cao
Yang-Xin Cao
Malcolm Orr Malcolm Orr
Author Profile Icon Malcolm Orr
Malcolm Orr
Arrow right icon
View More author details
Toc

Table of Contents (28) Chapters Close

Preface 1. Part 1: Getting Started with Amazon EKS
2. Chapter 1: The Fundamentals of Kubernetes and Containers FREE CHAPTER 3. Chapter 2: Introducing Amazon EKS 4. Chapter 3: Building Your First EKS Cluster 5. Chapter 4: Running Your First Application on EKS 6. Chapter 5: Using Helm to Manage a Kubernetes Application 7. Part 2: Deep Dive into EKS
8. Chapter 6: Securing and Accessing Clusters on EKS 9. Chapter 7: Networking in EKS 10. Chapter 8: Managing Worker Nodes on EKS 11. Chapter 9: Advanced Networking with EKS 12. Chapter 10: Upgrading EKS Clusters 13. Part 3: Deploying an Application on EKS
14. Chapter 11: Building Applications and Pushing Them to Amazon ECR 15. Chapter 12: Deploying Pods with Amazon Storage 16. Chapter 13: Using IAM for Granting Access to Applications 17. Chapter 14: Setting Load Balancing for Applications on EKS 18. Chapter 15: Working with AWS Fargate 19. Chapter 16: Working with a Service Mesh 20. Part 4: Advanced EKS Service Mesh and Scaling
21. Chapter 17: EKS Observability 22. Chapter 18: Scaling Your EKS Cluster 23. Chapter 19: Developing on EKS 24. Part 5: Overcoming Common EKS Challenges
25. Chapter 20: Troubleshooting Common Issues 26. Index 27. Other Books You May Enjoy

Building and pushing a container image to ECR

If we consider a simple API using Python and FastAPI, shown next, we need to first package that up into a Docker image locally. We can then test if it is working locally before we push it to ECR. I’ve chosen Python and FastAPI as they are very simple to get up and running, but you can create the container using any language or framework.

The Python code in the main.py file is shown next:

#!/usr/bin/env python3
'''simple API server that returns Hello World'''
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
    return {"message": "Hello World"}

We will also need a requirements.txt file, which will have the following entries:

nyio==3.6.1
click==8.1.3
fastapi==0.83.0
h11==0.13.0
httptools==0.5.0
idna==3.3
importlib-metadata==4.12.0
pydantic==1.10.2
python-dotenv==0.21.0
PyYAML==6.0
sniffio==1.3.0
starlette==0.19.1
typing...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime