Level 3: Save money on cloud costs

Audience: Users who want to use the AWS cloud efficiently.

Prereqs: You must have finished level 1.


Save money with these optimizations

A Lightning component gives you fine-grain control over the cloud lifecycle of that component.

Here are a few features that will enable you save a lot on your cloud costs:

15+ accelerators
Auto-stop idle machines
Auto-timeout submitted work
Use spot machines (~70% discount)
Work with massive datasets
Mount cloud storage
Use a custom container
# app.py
from lightning.app import LightningWork, LightningApp, CloudCompute


class YourComponent(LightningWork):
   def run(self):
      print('RUN ANY PYTHON CODE HERE')


# custom accelerators
compute = CloudCompute('gpu')
component = YourComponent(cloud_compute=compute)
app = LightningApp(component)

# OTHER ACCELERATORS:
# compute = CloudCompute('default')          # 1 CPU
# compute = CloudCompute('cpu-medium')       # 8 CPUs
# compute = CloudCompute('gpu')              # 1 T4 GPU
# compute = CloudCompute('gpu-fast-multi')   # 4 V100 GPU
# compute = CloudCompute('p4d.24xlarge')     # AWS instance name (8 A100 GPU)
# compute = ...


Next: Coordinate 2+ components

Now that you know how to organize arbitrary code inside a Lightning component, learn to coordinate 2 or more components into workflows which we call Lightning apps.