A head-to-head comparison of Heroku and AWS Elastic Beanstalk for a web app with workers and a database: deploys, background jobs, schedules, Postgres, pricing and what each one asks you to operate, with an example of the same app running in your own AWS account.

Heroku runs an app from a git push on dynos, with add-ons for Postgres and Redis and a Procfile that names the web and worker processes. Teams usually open Elastic Beanstalk when the bill grows with every Standard dyno or the app has to move into a company AWS account.
Beanstalk builds EC2 instances, a load balancer and Auto Scaling around the same code, and hands part of the platform work back to you.
Heroku figures come from its pricing page and the request timeout article, and Elastic Beanstalk figures from its pricing page and the worker environment guide, checked December 1, 2026.
A Heroku deploy is a git push or a container image, and the platform builds the slug, restarts the dynos and patches the operating system without asking for anything. Standard dynos add preboot for zero-downtime deploys, and scaling is a slider in the dashboard. In February 2026 Heroku moved to a sustaining engineering model, which keeps the platform supported for card-paying customers but stops new Enterprise contracts.
Elastic Beanstalk deploys an application version to an environment with a deployment policy of all at once, rolling, rolling with an additional batch, immutable or traffic splitting. Instance types, VPC subnets, security groups, the instance profile and environment variables are yours to set, usually through .ebextensions files or saved configurations, and platform version updates run in a weekly maintenance window if managed updates are turned on.
On Heroku a worker is another line in the Procfile that runs as its own dyno and reads from whatever queue the app uses, usually Redis through an add-on. Heroku Scheduler starts a one-off dyno every 10 minutes, every hour or once a day.
Elastic Beanstalk puts background work in a separate worker environment. A daemon on each instance reads from an SQS queue and sends each message as an HTTP POST to the app on localhost, failed messages go to a dead-letter queue, and periodic tasks in cron.yaml add messages to the same queue on a schedule. That is two environments to configure and deploy for one app, each with its own instances and IAM role.
Elastic Beanstalk itself is free, so the cost is the EC2 instances, the load balancer, RDS and data transfer, as its pricing page states, while Heroku charges from $7 a month for a Basic dyno to $25 for Standard-1X and $250 for Performance-M, plus add-ons, according to its pricing page. The difference in operations remains, since Heroku includes the operating system patching, routing and logs that Beanstalk leaves to you.
Encore is a backend framework with built-in infrastructure, and it keeps the Heroku habit of pushing code while the app runs in your own AWS account as Fargate services with RDS, SNS and SQS, as the AWS infrastructure docs describe. The web endpoints, the background worker and the schedule live in one codebase instead of a Procfile plus add-ons, or a web environment plus a worker environment.

Run in your terminal to get started locally.
A CSV export is a typical job for a worker dyno or a Beanstalk worker environment. Here the endpoint records the request and publishes an event, the subscriber builds the export and marks it done in one guarded update, so a redelivered message does nothing, and a nightly cron job removes exports older than 30 days:
// exports/exports.go
package exports
import (
"context"
"errors"
"time"
"encore.dev/beta/errs"
"encore.dev/cron"
"encore.dev/pubsub"
"encore.dev/storage/sqldb"
)
var db = sqldb.NewDatabase("exports", sqldb.DatabaseConfig{Migrations: "./migrations"})
type Requested struct {
ID int64 `json:"id"`
}
var requested = pubsub.NewTopic[*Requested]("export-requested", pubsub.TopicConfig{
DeliveryGuarantee: pubsub.AtLeastOnce,
})
type CreateParams struct {
AccountID int64 `json:"account_id"`
}
type Export struct {
ID int64 `json:"id"`
Status string `json:"status"`
Rows int64 `json:"rows"`
}
//encore:api public method=POST path=/exports
func Create(ctx context.Context, p *CreateParams) (*Export, error) {
if p.AccountID <= 0 {
return nil, &errs.Error{Code: errs.InvalidArgument, Message: "account_id is required"}
}
e := &Export{Status: "queued"}
err := db.QueryRow(ctx, `INSERT INTO exports (account_id) VALUES ($1) RETURNING id`, p.AccountID).Scan(&e.ID)
if err != nil {
return nil, err
}
if _, err := requested.Publish(ctx, &Requested{ID: e.ID}); err != nil {
return nil, err
}
return e, nil
}
//encore:api public method=GET path=/exports/:id
func Get(ctx context.Context, id int64) (*Export, error) {
e := &Export{ID: id}
err := db.QueryRow(ctx, `SELECT status, rows FROM exports WHERE id = $1`, id).Scan(&e.Status, &e.Rows)
if errors.Is(err, sqldb.ErrNoRows) {
return nil, &errs.Error{Code: errs.NotFound, Message: "export not found"}
}
if err != nil {
return nil, err
}
return e, nil
}
var _ = pubsub.NewSubscription(requested, "build-export", pubsub.SubscriptionConfig[*Requested]{
Handler: func(ctx context.Context, m *Requested) error {
// Count the account's orders as a stand-in for writing the CSV.
_, err := db.Exec(ctx, `
UPDATE exports e
SET status = 'done', finished_at = now(),
rows = (SELECT count(*) FROM orders o WHERE o.account_id = e.account_id)
WHERE e.id = $1 AND e.status = 'queued'`, m.ID)
return err
},
AckDeadline: 5 * time.Minute,
RetryPolicy: &pubsub.RetryPolicy{MinBackoff: 10 * time.Second, MaxBackoff: 10 * time.Minute, MaxRetries: 5},
})
//encore:api private
func Purge(ctx context.Context) error {
_, err := db.Exec(ctx, `DELETE FROM exports WHERE created_at < now() - interval '30 days'`)
return err
}
var _ = cron.NewJob("purge-exports", cron.JobConfig{
Title: "Delete exports older than 30 days",
Schedule: "0 3 * * *",
Endpoint: Purge,
})
-- exports/migrations/1_create_tables.up.sql
CREATE TABLE orders (
id BIGSERIAL PRIMARY KEY,
account_id BIGINT NOT NULL,
cents BIGINT NOT NULL
);
CREATE TABLE exports (
id BIGSERIAL PRIMARY KEY,
account_id BIGINT NOT NULL,
status TEXT NOT NULL DEFAULT 'queued',
rows BIGINT NOT NULL DEFAULT 0,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
finished_at TIMESTAMPTZ
);
encore run starts Postgres locally, applies the migration and runs the subscriber in the same process. A POST /exports is how you exercise that path: the endpoint records the request and publishes the event, and the in-process subscriber counts the account's orders and marks the export done. Cron jobs do not run locally, so the purge is checked by calling the endpoint. The Pub/Sub docs cover retries and dead-letter queues, and the cron docs cover schedules, which the Encore platform manages.
To deploy, follow Connect your cloud account and push, and the services, the database and the topic with its queue and dead-letter queue are created in your account. Encore provisions an IAM role for the service, or a service account on GCP. An AI coding agent that adds a second export format changes the subscriber and a migration in one diff, which it can run locally before it reaches review.
Best fit: Teams leaving Heroku for their own AWS account who want to keep deploying with a push and have workers and schedules declared in the same code as the endpoints.
Choose Heroku when a small team values not touching infrastructure more than the price per dyno and the app does not need to live in a company AWS account. Choose Elastic Beanstalk when the app must run in AWS and the team is ready to own instance types, worker environments and platform updates. Encore suits the case in between, with the app in your own AWS account and the infrastructure created from the code.
Yes. It is the closest AWS service to Heroku, since it takes application code, provisions EC2 instances, a load balancer and Auto Scaling, and handles deploys. Unlike Heroku, those resources live in your AWS account, and you configure instance types, VPC placement and platform updates yourself.
Elastic Beanstalk has no charge of its own, and you pay for the EC2 instances, load balancer and database it uses, as its [pricing page](https://aws.amazon.com/elasticbeanstalk/pricing/) states. Heroku charges per dyno, from $7 a month for a Basic dyno to $25 for Standard-1X and $250 for Performance-M, plus add-ons, according to its [pricing page](https://www.heroku.com/pricing/).
No. In February 2026 Heroku moved to a sustaining engineering model focused on stability and security, and it stopped offering Enterprise contracts to new customers, while card-paying customers keep the same pricing and service.
Declare the web endpoints, the Pub/Sub topic for background work, the cron job and the database in code with Encore, connect your AWS account and push. Encore deploys the services to Fargate with SNS, SQS and RDS in that account and runs the same app locally with encore run.
Own your AWS or GCP cloud without giving up PaaS speed
Define databases, Pub/Sub, cron jobs, and object storage directly in TypeScript or Go. Encore provisions everything in your own cloud account with zero Terraform or lock-in.