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.
This guide assumes:
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
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/'
# }
# Get file data
curl https://<...>.execute-api.<YOUR_REGION>.amazonaws.com/stage/
# > Startup at 2023-01-12 18:30:36.455748
From the compiled directory still,
# Tear down when done
pulumi destroy -s py-cloudfs