|
| 1 | +# AI-Driven Development |
| 2 | + |
| 3 | +## Speed Up Development with Intelligent Automation |
| 4 | + |
| 5 | +AI-driven development workflows represent a fundamental shift from reactive to proactive development. Instead of waiting for issues to arise, AI anticipates needs, suggests optimizations, and automates routine tasks, allowing developers to focus on creative problem-solving and innovation. |
| 6 | + |
| 7 | +### Setting Up Your AI Development Environment |
| 8 | + |
| 9 | +Let's create your Coder workspace with comprehensive AI development tools. |
| 10 | + |
| 11 | +#### Step 1: Access Your AI-Enhanced Workspace |
| 12 | + |
| 13 | +Create a workspace using the AWS Workshop - EC2 (Linux) Q Developer template: |
| 14 | +1. **Access your Coder dashboard** and click "Create Workspace" |
| 15 | +2. **Select the AWS Workshop - EC2 (Linux) Q Developer template** (created from the [template](../../templates/awshp-linux-q-base/README.md) in this repo) |
| 16 | +3. **Configure the workspace parameters**: |
| 17 | + - **Name**: `linux-qdev-workspace` |
| 18 | + - **Instance type**: 2 vCPU, 4 GiB RAM |
| 19 | + - **Region**: us-east-1 (Default) |
| 20 | + - **Disk Size**: 30 GB (Default) |
| 21 | + |
| 22 | +4. **Click "Create Workspace"** and wait for it to start |
| 23 | + |
| 24 | +> **ℹ️ Info**: The selected Coder workspace template will automatically provision the AWS CLI, CDK, Amazon Q Developer CLI and other tools needed for AI-Driven AWS Development. |
| 25 | +
|
| 26 | +#### Step 2: Access Your Linux Q Developer Workspace |
| 27 | + |
| 28 | +Once your workspace is running: |
| 29 | + |
| 30 | +1. **Open the workspace** from your Coder dashboard |
| 31 | +2. **Launch code-server** or your preferred editor |
| 32 | +3. **Open a terminal** within the workspace |
| 33 | + |
| 34 | +#### Step 3: Initialize Workshop Git/Github repo |
| 35 | +Once in your workspace, let's create a workshop directory and initialize a git repo: |
| 36 | +```bash |
| 37 | +mkdir ai-dev-workflows |
| 38 | +``` |
| 39 | +Now from code-server or VS Code: |
| 40 | + |
| 41 | +1. **Use File/Open Folder** to open the workshop directory |
| 42 | +2. **Use Git extension** to initialize a git repository in the current directory |
| 43 | + |
| 44 | +#### Step 4: Initialize AI Development Tools |
| 45 | +Back in your workspace terminal session, let's set up the AI development environment: |
| 46 | +```bash |
| 47 | +# Initialize the Q Developer CLI |
| 48 | +q login # Use for Free with Builder ID option, and follow prompts |
| 49 | +q chat # Initialize chat session |
| 50 | +``` |
| 51 | + |
| 52 | +### Workflow 1: AI-Assisted Feature Development |
| 53 | +#### Scenario: Create a simple Cloud-Native Task Management Web App |
| 54 | +Let's walk through developing a new feature using AI assistance from start to finish. |
| 55 | + |
| 56 | +Step 1: Requirements Analysis with AI, start by describing your feature in natural language: |
| 57 | +```bash |
| 58 | +# Use Amazon Q Developer to analyze requirements with the following prompt: |
| 59 | +analyze the following requirements: "Create a simple task management web app that tracks task id, description, priority, and completion date. Provide two ways to interact with the data, one that summarizes open tasks by priority and another lists completed tasks by date" |
| 60 | +``` |
| 61 | +Amazon Q will provide: |
| 62 | +- Technical requirements breakdown |
| 63 | +- Architecture suggestions |
| 64 | +- Implementation approach |
| 65 | +- Potential challenges and solutions |
| 66 | + |
| 67 | +Step 2: AI-Generated Project Structure |
| 68 | +```bash |
| 69 | +# Next, have Amazon Q generate the supporting project structure with the following prompt: |
| 70 | +generate a supporting project structure for an AWS CDK application that uses typscript for the front end components and python for back-end API components |
| 71 | +``` |
| 72 | + |
| 73 | +> **ℹ️ Info**: Notice how Amazon Q always prompts you to "trust" it when creating or updating content in your Coder workspace. |
| 74 | +
|
| 75 | +This should create something similar to this: |
| 76 | +```bash |
| 77 | +task-management-app/ |
| 78 | +├── infrastructure/ # AWS CDK TypeScript code |
| 79 | +│ ├── bin/app.ts # CDK app entry point |
| 80 | +│ ├── lib/ # CDK stack definitions |
| 81 | +│ │ ├── database-stack.ts # DynamoDB table |
| 82 | +│ │ ├── backend-stack.ts # Lambda + API Gateway |
| 83 | +│ │ └── frontend-stack.ts # S3 + CloudFront |
| 84 | +│ └── package.json # CDK dependencies |
| 85 | +├── backend/ # Python Lambda functions |
| 86 | +│ ├── src/ |
| 87 | +│ │ ├── models/ # Data models |
| 88 | +│ │ ├── services/ # Business logic |
| 89 | +│ │ └── handlers/ # Lambda handlers |
| 90 | +│ └── requirements.txt # Python dependencies |
| 91 | +├── frontend/ # React TypeScript app |
| 92 | +│ ├── src/ |
| 93 | +│ │ ├── components/ # React components |
| 94 | +│ │ ├── services/ # API client |
| 95 | +│ │ └── types/ # TypeScript interfaces |
| 96 | +│ └── package.json # React dependencies |
| 97 | +└── scripts/ # Deployment scripts |
| 98 | +``` |
| 99 | + |
| 100 | +Step 3: AI-Generated AWS Deployment |
| 101 | +```bash |
| 102 | +# Smoke-test deployment to AWS by having Amazon Q deploy the generated web app to the current AWS account with the following prompt: |
| 103 | +Smoke test the web app deployment to the current AWS account using the created deployment scripts |
| 104 | +``` |
| 105 | + |
| 106 | +> **ℹ️ Info**: Notice how Amazon Q will find and debug issues as it works with the existing scripts and workspace environment, installing required dependencies as needed. Additionally, you will most likely see Amazon Q iterate across Lambda Functions, Back-End Schema, and other component issues as it tests the CDK stacks being deployed. |
| 107 | +
|
| 108 | +When completed, at least your Database and Backend stacks should be successfully deployed and smoke-tested. You can continue to prompt Amazon Q to complete the full application deployment, if desired. It is suggested you commit and push changes to your workshop Git repo at this point, as this Git repo will be used in the next AI-Driven Workflow example. |
| 109 | + |
| 110 | +Step 4: Cleanup AI-Generated AWS Deployment |
| 111 | +```bash |
| 112 | +# Have Amazon Q safely remove any deployments created for smoke-testing from the current AWS account with the following prompt: |
| 113 | +Remove any CDK stack deployments used for smoke-testing the task mananagement web app from the current AWS account. Double-check that only task management stacks are being deleted and nothing else. |
| 114 | +``` |
| 115 | +This should remove any deployed components and ensure Amazon Q double-checks and reviews what was deleted. You can now end your Q CLI chat session with: |
| 116 | +```bash |
| 117 | +/quit |
| 118 | +``` |
| 119 | + |
| 120 | +> **🚀 Workflow Optimization**: These AI development workflows can reduce development time by 60-80% while improving code quality. Start with one workflow and gradually add more as your team becomes comfortable. |
| 121 | +
|
| 122 | +## [Next Steps](ai-driven-automation.md) |
| 123 | + |
| 124 | +Now that you've experimented with AI-Driven Development, you can now see how [AI-Driven Automation](ai-driven-automation.md) can support your development workflow. |
0 commit comments