Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSC510 Lecture 17

CSC510 Lecture 17

EC2 + Docker
(20260925)

Avatar for Javier Gonzalez-Sanchez

Javier Gonzalez-Sanchez PRO

October 15, 2026

Transcript

  1. CSC 5100 Modern Software Engineering Lecture 16. Elastic Compute Cloud

    (+ Docker) Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.info ffi o ce: 14 -227
  2. It is not VM • Cont iners sh re the

    host oper ting system kernel, libr ries, nd bin ries. • Virtu l m chines run its own guest oper ting system, a a a a a a a a a a a a a a a a 6 a • Virtu l m chines provide full-blown virtu liz tion of h rdw re resources, including CPU, memory, stor ge, nd networking.
  3. Docker | Steps 1. A text file that contains instructions

    for building a Docker image 3. A container is a runtime instance of an image. It encapsulates the execution environment for a specific application or process, including the filesystem, environment variables, network settings, and runtime options. 2. A package that includes everything needed to run software, including the code, runtime, libraries, dependencies, and configuration files. 7
  4. From laptop to cloud LOCAL Docker + URSim Image →

    container → ports CLOUD PUBLIC ACCESS EC2 + Docker DNS + reverse proxy VM → SSH → scaling Domain → HTTPS → WebSockets 35 02
  5. Universal Robots URSim A real application, not a toy web

    server Image: universalrobots/ursim_e-series PolyScope: graphical robot interface via noVNC (port 6080). Robot interfaces: URScript on 30002; RTDE on 30004. A local browser and local Java/Python clients can access the simulator. 36 05
  6. Run URSim locally with Docker docker pull universalrobots/ursim_e-series docker run

    -d --name ursim -e ROBOT_MODEL=UR3e \ -p 127.0.0.1:6080:6080 \ -p 127.0.0.1:30002:30002 \ -p 127.0.0.1:30004:30004 \ universalrobots/ursim_e-series Open: http://localhost:6080/vnc.html 37 06
  7. Local port mapping: where does 6080 go? Browser localhost:6080 Host

    port 127.0.0.1:6080 Container web server :6080 -p 127.0.0.1:6080:6080 Binding to 127.0.0.1 means the service is not directly exposed on the host’s public interfaces. 38 07
  8. Inspect a running container docker images docker ps -a docker

    logs --tail 30 ursim docker stats --no-stream free -h What to check • Image downloaded? • Container running? • Application healthy? • Enough RAM? • Logs show errors? “Running” is a container state, not proof that the GUI or application is healthy. 39 08
  9. Why move from local Docker to the cloud? Remote access:

    use a simulator without keeping your laptop running. Shared infrastructure: one server can host services for a class or team. Adjustable resources: select CPU, memory, and storage as needed. Operational responsibilities: security, networking, monitoring, and cost. 40 09
  10. What is Amazon EC2? EC2 = Elastic Compute Cloud AWS

    EC2 Virtual machine Ubuntu Linux Guest operating system Docker Engine URSim container EC2: control the OS and run long-lived services. 41 10
  11. Our EC2 deployment: actual settings Region US West (Oregon), us-west-2

    Instance name CSC5100-URSim Operating system Ubuntu Linux, x86-64 Working instances t3.small · 2 GiB; t3.medium · 4 GiB Storage 30 GiB EBS (configured) 42 11
  12. Launch, connect, and install Docker # On your Mac: connect

    to EC2 ssh -i ~/.ssh/CSC5100-URSim-Key.pem ubuntu@EC2_PUBLIC_IP # On Ubuntu EC2: install Docker sudo apt update sudo apt install -y docker.io sudo systemctl enable --now docker sudo docker run --rm hello-world AWS security group: allow SSH (22) from your IP, not from the entire internet. 43 12
  13. Vertical scaling: a measured result t3.micro t3.small t3.medium 1 GiB

    2 GiB 4 GiB Docker slow; noVNC stuck PolyScope worked PolyScope worked Smallest successfully tested: t3.small. This is not a guarantee of long-term stability. 44 14
  14. What did “working” look like? Verified ✓ URSim 5.26.1 ✓

    Browser UI ✓ noVNC session ✓ Remote EC2 ✓ Docker container PolyScope loaded in a Mac browser through an SSH tunnel. 45 15
  15. SSH tunneling: secure access without public port 6080 Mac browser

    localhost:6080 SSH encrypted port forwarding EC2 localhost Docker → URSim ssh -i ~/.ssh/CSC5100-URSim-Key.pem -N \ -L 6080:127.0.0.1:6080 ubuntu@EC2_PUBLIC_IP SSH tunnel forwards TCP traffic; the EC2 security group does not need to expose port 6080. 46 16
  16. Next: A real domain and HTTPS Browser https://ursim.javiergs.phd DNS EC2

    public IP Apache or Caddy HTTPS :443 URSim web server 127.0.0.1:6080 Reverse proxy: public HTTPS → private container HTTP/WebSocket 47 17
  17. Apache vs. Caddy: same architectural role Apache HTTP Server Caddy

    mod_proxy + mod_proxy_http VirtualHost + ProxyPass TLS often via Certbot reverse_proxy directive Automatic HTTPS WebSocket upgrades handled Both are separate from the URSim container; both proxy requests and WebSocket traffic. Security: configure HTTPS + authentication before exposing PolyScope publicly. 48 18
  18. Reverse Proxy Handling of a Request 1 Browser resolves ursim.javiergs.phd

    via DNS. 2 Apache/Caddy receives HTTPS on port 443. 3 Proxy forwards HTTP to EC2 localhost:6080. 4 Docker maps host port 6080 to container port 6080. 5 URSim returns HTML/JS; WebSocket carries interactive updates. 6 Proxy returns the response over HTTPS. Approximate t3.small compute: $0.0208/hour in us-west-2, excluding storage, IPv4, transfer, and CPU credits. 49 19
  19. Takeaways Docker packages the application; EC2 provides the machine. Port

    mapping, SSH tunneling, and reverse proxying are different layers. Application health requires more than a “running” container. Vertical scaling can fix resource constraints without reinstalling software. DNS + HTTPS + authentication enable safer browser access. 50 22
  20. CSC 3100 Software Engineering Javier Gonzalez-Sanchez, Ph.D. [email protected] Fall 2026

    Copyright. These slides may be used only as study material for CSC 5100 within the California State University system. They may not be distributed or used for any other purpose.