Deploying Python Applications to cloud
- Options:
- Virtual Machines/EC2 instances (IaaS):
- Steps:
- install python
- create virtual environment
- Run the application
- scaling
- load balancing
- Steps:
- PaaS (Platform as a Service):
- Directly deploy your application into python runtime
- Serverless (find below)
- Virtual Machines/EC2 instances (IaaS):
Serverless
Serverless computing is a cloud-native development model that allows developers to build and run applications without the need to manage servers directly. Despite the term “serverless,” physical servers are still utilized; however, their management—including provisioning, scaling, and maintenance—is handled by the cloud provider. This abstraction enables developers to focus on writing code rather than worrying about the underlying infrastructure.
Key Features of Serverless Computing
- On-Demand Resource Allocation: Serverless computing operates on a pay-as-you-go model, where resources are allocated dynamically based on demand. This means that users only pay for the actual computing resources consumed during execution, rather than for reserved server capacity[1][3].
- Event-Driven Architecture: Serverless applications typically follow an event-driven model, where code execution is triggered by specific events or requests. This allows for automatic scaling—resources are allocated as needed and can scale down to zero when not in use, resulting in cost efficiency[2][4].
- Managed Infrastructure: The cloud provider takes care of routine operational tasks such as load balancing, security patches, and scaling. This reduces the operational burden on developers, allowing them to focus more on application logic rather than infrastructure management[2][3].
Types of Serverless Services
- Function-as-a-Service (FaaS): This is a common serverless model where developers write individual functions that are executed in response to events. Examples include AWS Lambda and Google Cloud Functions. These functions are stateless and can be triggered by various events, such as HTTP requests or changes in data[2][5].
- Backend-as-a-Service (BaaS): This model provides developers with access to backend services like databases and authentication without needing to manage them directly. BaaS often integrates with FaaS for complete application development[1][2].
Advantages of Serverless Computing
- Cost Efficiency: Users incur costs only when their code is executed, eliminating expenses associated with idle server time[1][3].
- Scalability: Applications can automatically scale up or down based on traffic demands without manual intervention[2][4].
- Faster Development: Developers can deploy applications more quickly since they do not need to manage server infrastructure[5].
Challenges and Considerations
While serverless computing offers significant benefits, it also comes with challenges such as:
- Cold Starts: When a function has not been used for a while, it may take longer to execute the next time it is called due to the need to initialize resources—this is known as a “cold start” [1][3].
- Vendor Lock-In: Relying heavily on a specific cloud provider’s services may lead to challenges if an organization wishes to switch providers later[3].
In summary, serverless computing represents a shift in how applications are developed and deployed, making it easier for developers to create scalable applications without the complexities of managing server infrastructure.
Citations:
[1] https://www.cloudflare.com/learning/serverless/what-is-serverless/
[2] https://www.redhat.com/en/topics/cloud-native-apps/what-is-serverless
[3] https://en.wikipedia.org/wiki/Serverless_computing
[4] https://aws.amazon.com/serverless/
[5] https://cloud.google.com/serverless
[6] https://www.serverless.com
Serverless (FaaS) offerings
- AWS: Lambda
- Azure: Azure Functions
- GCP: Google Functions
Application: Lambda
-
Watch classroom recording
- Lambda function needs to speak with dynamodb
