Concepts
Resources
Overview
Resources allow you to add databases, cloud storage, task queues, and more to your application by simply importing them in your code. They unify managing infrastructure in your cloud account and using it in your code.
To create infrastructure, import the LaunchFlow resource, use it in your code, and run lf create
on the command line. Then,
- Make updates to the its configuration by updating the object in your code and running
lf create
again - Use utility methods or the underlying cloud clients to interface with it
- Delete it by running the
lf destroy
command
1import launchflow as lf
2
3# Create / Connect to a Postgres Cluster on CloudSQL
4postgres = lf.gcp.CloudSQLPostgres("postgres-cluster", disk_size=10, tier="db-f1-micro")
5
6if __name__ == "__main__":
7 # Built-in utility methods for working with Postgres
8 postgres.query("SELECT * FROM my_table")
9
10 # Built-in connectors for common ORMs
11 postgres.sqlalchemy_engine()
12 postgres.django_settings()
13
14 # Async support
15 postgres.sqlalchemy_async_engine()
For more comprehensive examples, see the Get Started Guide.
For a full list of resources, see the Reference Documentation.
CLI Commands
Create Resources
1lf create
Delete Resources
1lf destroy
List Resources
1lf resources list
For a full list of options see the command references: