How can I access Swagger UI on my AWS EC2 instance?

1/21/2022

I am very new to the AWS world and have recently been tasked with transferring a Web API from a traditional server set up to AWS. This has involved the following steps:

  1. Creating a new EKS cluster using eksctl
  2. Creating an ECR repository
  3. Publishing the Docker image of the ASP.NET Web API to the repo
  4. Configure service and deployment YAML
  5. Deploy application using kubectl
  6. Access Web API application using Load Balancer URL

The above steps have been successful. However I am having trouble accessing Swagger UI from the Load Balancer URL. Swagger UI was running successfully locally from the Docker image in VS2022. But I get a 404 when trying to resolve the same URL appended to the Load Balancer URL (see the image).

What additional steps are required for Swagger UI to execute from the aforementioned application setup?

Here are the YAML files:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ekstest2
  labels:
    app: ekstest2
spec:
  replicas: 3
  selector:
    matchLabels:
      app: ekstest2
  template:
    metadata:
      labels:
        app: ekstest2
    spec:
      containers:
      - name: ekstest2
        image: xxxxx.dkr.ecr.us-east-2.amazonaws.com/ekstest2:ekstest2
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: ekstest2
  labels : 
    app  : ekstest2
spec:
  ports:
    - port: 80
      targetPort: 80
  selector:
    app: ekstest2
  type : LoadBalancer

Swagger 404

-- Rez Khan
amazon-ec2
amazon-eks
amazon-web-services
kubernetes
swagger-ui

0 Answers