Simon Obetko, Dev @ Stacktape
March 14, 2024
In the developer community, the discussion around whether serverless or containerized approaches reign supreme has been lively. Which one's better? Stacktape's philosophy is straightforward: developers shouldn't have to limit themselves to one paradigm. By supporting both serverless and containers, Stacktape enables teams to pick the right tool for the job.
Containers vs Serverless Lambdas? It's not about preferring one over the other; it's about choosing the right one for your needs.
Stacktape Lambda functions (running on AWS Lambda) are great for event-driven architectures, microservices, and apps with changing traffic. You only pay for what you use, without the hassle of managing servers.
Setting up Lambdas with Stacktape is straightforward. Just point to your handler file, and Stacktape handles the rest, packaging and deploying your code. This simplicity removes the complex steps usually involved with Lambda, like creating deployment packages and sorting out dependencies.
Lambda's Flexibility
Lambda can handle a lot of different tasks:
resources:generateReport:type: functionproperties:packaging:type: stacktape-lambda-buildpackproperties:entryfilePath: src/generate-report.ts
With Stacktape, setting up access to other AWS resources for your Lambda functions is easier. Instead of diving into IAM roles and policies, you tell Stacktape what your Lambda needs access to, and it sorts out the permissions and injects required environment variables into your function. This means less time on setup and fewer chances for security slip-ups.
resources:generateReport:type: functionproperties:packaging:type: stacktape-lambda-buildpackproperties:entryfilePath: src/generate-report.tsconnectTo:- reportDataTablereportDataTable:type: dynamo-db-tableproperties:primaryKey:partitionKey:name: idtype: string
Read on in our documentation for more information on Lambda functions
Containers are ideal for traditional applications, complex environments, or when you need full control over the runtime and dependencies. They offer an isolated environment for your application, ensuring consistency across development, testing, and production.
Stacktape offers flexible options for packaging your container:
Stacktape supports various flavors of container workloads, each designed for specific use cases:
You do not need to learn about all the underlying AWS services such as Fargate, EC2 or Elastic Load Balancing. Stacktape abstracts these complexities away from you, so you can only focus on what you need.
resources:web:type: web-serviceproperties:packaging:type: stacktape-image-buildpackproperties:entryfilePath: src/index.tsresources:cpu: 1memory: 1024
Often, you might want your server's main tasks in a container but offload resource-intensive jobs (e.g., report generation) to a Lambda function. Stacktape makes this mix easy. You get containers for heavy lifting and Lambda for specific, scalable tasks. This way, your core application runs in containers, with Lambda stepping in when needed. Stacktape streamlines this setup, ensuring containers and Lambda work well together in your AWS setup.
resources:# serves as entry gateway to our appentryGateway:type: http-api-gateway# serves bulk load of what our app doesweb:type: multi-container-workloadproperties:containers:- name: nuxt-apppackaging:type: stacktape-image-buildpackproperties:entryfilePath: src/index.tsevents:- type: http-api-gatewayproperties:httpApiGatewayName: entryGatewaycontainerPort: 3000method: '*'path: '*'resources:cpu: 1memory: 1024# offloading generating report to a lambdagenerateReport:type: functionproperties:packaging:type: stacktape-lambda-buildpackproperties:entryfilePath: src/generate-report.tsconnectTo:- reportDataTableevents:- type: http-api-gatewayproperties:httpApiGatewayName: entryGatewaymethod: GETpath: /generate-report
Ever developed your app locally, only to have it crumble after deploying to the cloud due to missing permissions or environment variables? We've been there. That's why we created `stacktape dev`.
`stacktape dev` was crafted to let you develop your workload interactively, ensuring it mirrors the production environment as closely as possible. Here's how it works with Lambda functions and containers:
We've covered our Serverless functions and Container solutions, showing how Stacktape makes AWS development and deployment easier. But there's much more to explore.
To really see what Stacktape can do, try our starter projects. They're made to help you start fast, using popular frameworks to give you practical experience with serverless and containers in real situations.
We are looking forward to seeing what you build with Stacktape, and your feedback to make it even better.
Let Stacktape transform your AWS into a developer-friendly platform.
Learn more