🎓 Practical Workshop: Deploy Different API Strategies with Minimal Code Changes#3
🎓 Practical Workshop: Deploy Different API Strategies with Minimal Code Changes#3
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @macalbert, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly enhances the project's workshop capabilities by introducing and configuring multiple Docker-based API deployment strategies within a unified CDK infrastructure. It aims to provide a clear, hands-on comparison of different containerization approaches for serverless applications, making it easy for users to experiment with and understand the trade-offs of each strategy.
Highlights
- Workshop Structure & Strategy Comparison: This PR introduces a practical workshop setup to demonstrate and compare three distinct API deployment strategies (.NET Minimal API, FastAPI with AWS Lambda base, and FastAPI with custom RIC) using a single CDK infrastructure, allowing easy switching between them for hands-on learning.
- FastAPI Dockerfile Updates: The FastAPI application now includes a new
Dockerfile.ricfor a custom slim image with AWS Lambda Runtime Interface Client (RIC), and the existingDockerfile.lambdahas been renamed toDockerfileand updated for the AWS Lambda public ECR image strategy. The oldDockerfile.publichas been removed. - Infrastructure Configuration: The CDK infrastructure code (
iac.ts) has been updated to default to the FastAPI custom RIC strategy, with clear comments enabling quick switching to other deployment options for the workshop participants.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request sets up an excellent workshop for comparing different API deployment strategies. The changes are well-structured and easy to follow. My feedback primarily focuses on optimizing the Dockerfiles to follow best practices for layer caching and minimizing image size, which are important concepts for the workshop. I've also suggested a change to the local development server port to avoid potential permissions issues.
🎯 Workshop Objective
This PR demonstrates how to deploy three different API strategies using the same CDK infrastructure with minimal configuration changes. Perfect for hands-on learning and comparing deployment approaches!
🔧 Three Deployment Strategies - One Simple Switch
Strategy Selection in
workshop/src/iac/bin/iac.ts📝 Workshop Exercise: Simply uncomment the desired strategy and deploy!
📊 Deployment Strategies Comparison
mcr.microsoft.com/dotnet/aspnet:9.0-alpinepublic.ecr.aws/lambda/python:3.9python:3.9-slim+ RIC🎯 Strategy Deep Dive
Strategy 1: .NET Minimal API
/health,/greetings, Swagger docsStrategy 2: FastAPI with AWS Lambda Base Image
/,/health,/info,/echoStrategy 3: FastAPI with Custom RIC ⭐ Currently Active
/,/health,/info,/echo🚀 Workshop Instructions
Quick Strategy Switch & Deploy
Choose Your Strategy (edit
workshop/src/iac/bin/iac.ts):# Open the file and uncomment your preferred strategy code workshop/src/iac/bin/iac.tsDeploy in One Command:
cd workshop/src/iac cdk deploy --allTest Your Deployment:
📱 Compare Deployment Info
Each strategy exposes its configuration via the
/infoendpoint:{ "runtime": "FastAPI", "deployment_type": "lambda", "container_info": { "image_type": "python:3.9-slim", // Shows current strategy "runtime_interface": "ric" // Shows integration method } }🎯 Workshop Learning Outcomes
💡 Key Lessons
🔄 Easy Experimentation
📈 Real-World Applications
🔍 Current Configuration
Active Strategy: Python with Custom Slim Image + RIC
workshop/src/apps/FastApiApp/Dockerfile.ric🛠️ Technical Implementation
Dockerfile Comparison
AWS Lambda Base (
Dockerfile):Custom RIC (
Dockerfile.ric):Environment Variable Tracking
Each strategy sets identifying environment variables:
DEPLOYMENT_TYPE:lambda|fargateIMAGE_TYPE: Base image identifierRUNTIME_INTERFACE:direct|ric