Skip to content

Latest commit

 

History

History

py-cloudfs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Cloudfs Sample App

The py-cloudfs sample application demonstrates how to use the @klotho::persist annotation to store files. The sample application exposes one endpoint, with path / to return the content of a stored file.

Prerequisites

This guide assumes:

Run the app locally

run the terminal commands:

pip install -r requirements.txt
make run
# Get file data
curl http://localhost:3000/ 
# > Startup at 2023-01-12 18:30:36.455748

Compile and Deploy with Klotho

run the terminal commands:

# Compile the app
klotho . --app py-cloudfs -p aws
# Go into the compiled directory
cd compiled
# If you didn't set the aws region as indicated in the compiler output, do that now
pulumi config set aws:region YOUR_REGION -s py-cloudfs
# npm install
npm install
# Deploy
pulumi up -s py-cloudfs
# Outputs: {
#   apiUrl: 'https://<...>.execute-api.<YOUR_REGION>.amazonaws.com/stage/'
# }

Calling your service

# Get file data
curl https://<...>.execute-api.<YOUR_REGION>.amazonaws.com/stage/
# > Startup at 2023-01-12 18:30:36.455748

Clean Up

From the compiled directory still,

# Tear down when done
pulumi destroy -s py-cloudfs