Overview
Amazon S3 (Simple Storage Service) is used to store PDF documents that you upload through Workshop Cloud Chat. These documents can then be synchronized with a Bedrock Knowledge Base for AI-powered document retrieval.Make sure you have configured AWS credentials before setting up S3.
Required Parameters
The AWS region where your S3 bucket is located.Example:
us-east-1, us-west-2Placeholder: us-east-1The name of your S3 bucket where PDFs will be stored.Example:
workshop-docs-bucketBucket names must:- Be globally unique across all AWS accounts
- Be 3-63 characters long
- Contain only lowercase letters, numbers, hyphens, and periods
- Not be formatted as an IP address
The folder prefix (path) within the bucket where documents will be stored.Default:
documentosExample: If you set prefix to pdfs, files will be uploaded to s3://your-bucket/pdfs/The prefix helps organize files and can be used to separate different types of documents.
Configuration Steps
Open S3 Configuration Dialog
Click the gear icon (⚙) next to “Cargar documentos PDF a S3” in the S3 panel.The dialog titled “Configuración de S3” will open.
Save Configuration
Click the “Guardar” button to save your S3 settings.The configuration is stored in browser localStorage.
Creating an S3 Bucket
If you don’t have an S3 bucket yet:Open S3 Console
Navigate to the Amazon S3 Console.
Configure Bucket
- Bucket name: Choose a globally unique name (e.g.,
workshop-chat-docs-20240315) - Region: Select the same region where your Bedrock agent is deployed
- Block Public Access: Keep “Block all public access” enabled (recommended for security)
- Leave other settings as default unless you have specific requirements
Uploading Documents
Once S3 is configured, you can upload PDF documents:Select Files
You can select PDF files in two ways:Drag and Drop:
- Drag one or more PDF files from your computer
- Drop them onto the dropzone area that says “Arrastra y suelta tus documentos PDF aquí”
- Click anywhere on the dropzone
- A file picker dialog will open
- Select one or more PDF files (multi-select is supported)
Upload to S3
Click the “Cargar” button to upload the selected files.The upload status will update to show progress:
- “Cargando documento…” (while uploading)
- “PDF cargado correctamente…” (on success)
- Error message if upload fails
File Upload Implementation
The upload process handles file validation and naming: Fromsrc/pages/api/upload-pdf.ts:4:
src/pages/api/upload-pdf.ts:33-45:
src/pages/api/upload-pdf.ts:54:
Managing Documents
View Document List
The S3 panel displays all documents in your configured bucket and prefix: Fromsrc/pages/api/upload-pdf.ts:106-112:
- File name (extracted from the S3 key)
- Visual card with hover effects
Delete Documents
To remove a document from S3:- Locate the document in the list
- Click the trash icon (🗑️) button on the right side of the document card
- The document is immediately deleted from S3
- The list refreshes to show the updated document set
src/pages/api/upload-pdf.ts:154-159:
Refresh Document List
To manually refresh the document list:- Click the refresh icon (↻) button next to the “Cargar” button
- The application fetches the latest document list from S3
How S3 Client Works
The S3 client is initialized with your AWS credentials: Fromsrc/pages/api/upload-pdf.ts:6-19:
Upload Operation
Uploading uses thePutObjectCommand:
From src/pages/api/upload-pdf.ts:60-67:
List Operation
Listing documents uses theListObjectsV2Command:
From src/pages/api/upload-pdf.ts:99-104:
Validation Logic
The upload section is enabled only when S3 is properly configured: Fromsrc/pages/index.astro:1529:
- S3 is configured
- At least one PDF file is selected
src/pages/index.astro:1533-1537:
Drag and Drop Interface
The dropzone provides visual feedback:- Normal state: Dashed border with neutral colors
- Hover state: Border color changes to primary color
- Drag over state: Border and shadow highlight, slight upward translation
- Disabled state: Reduced opacity, “not-allowed” cursor
src/pages/index.astro:780-802:
Managing Configuration
Clear S3 Configuration
To remove S3 settings:- Open the S3 configuration dialog
- Click “Borrar configuración”
- This clears region, bucket name, and prefix from localStorage
Cancel Without Saving
To close the dialog without applying changes:- Click “Cancelar sin guardar”
- The dialog closes and previous S3 settings remain unchanged
Troubleshooting
Upload Section Disabled
Symptoms: Dropzone shows disabled state, upload button is grayed out. Solutions:- Verify AWS credentials are configured
- Ensure S3 region and bucket name are provided
- Check the configuration summary panel
”Debe seleccionar un archivo PDF” Error
Symptoms: Upload fails with this error message. Solutions:- Ensure you’ve selected at least one file
- Verify the file is actually selected (check the preview list)
“El archivo debe ser PDF” Error
Symptoms: Upload fails when trying to upload a file. Solutions:- Only PDF files (
.pdfextension) are supported - Check that your file has the correct extension
- The file must have MIME type
application/pdf
”Faltan parámetros de S3” Error
Symptoms: API returns 400 error when uploading. Solutions:- Re-open S3 configuration dialog
- Verify region and bucket name are filled
- Ensure AWS credentials are configured
- Save configuration again
Permission Denied Errors
Symptoms: Upload fails with access denied or permission error. Solutions:- Check IAM user/role has
s3:PutObjectpermission for your bucket - Verify IAM user has
s3:ListBucketpermission - Check bucket policy doesn’t block your requests
- Ensure bucket exists in the specified region
Documents Not Appearing
Symptoms: Uploaded successfully but documents don’t show in the list. Solutions:- Click the refresh button (↻) to reload the document list
- Verify the prefix matches what you configured
- Check S3 console to confirm files are actually uploaded
- Ensure IAM user has
s3:ListBucketpermission
Required IAM Permissions
Your IAM user or role needs these S3 permissions:Best Practices
Use Descriptive Prefixes
Organize documents with meaningful prefixes like
legal/, technical/, reports/.Enable Versioning
Turn on S3 versioning to protect against accidental deletions and overwrites.
Set Lifecycle Policies
Configure lifecycle rules to automatically archive or delete old documents.
Monitor Bucket Size
Use CloudWatch metrics to track storage usage and costs.
Next Steps
- Configure Knowledge Base to sync uploaded documents
- Learn about Document Management
- Understand S3 Costs and Optimization