AWS
Elastic Beanstalk
Disk Capacity
Cloud Computing
Instance Management

AWS Elastic Beanstalk - Increase Instance Disk Capacity

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

Elastic Beanstalk environments run on EC2 instances, so increasing disk capacity usually means changing the root EBS volume size or attaching extra EBS storage through environment configuration. The important operational detail is that this is an infrastructure change: Elastic Beanstalk will typically replace instances so the new volume settings take effect.

The Usual Case: Increase the Root Volume

For many applications, the simplest fix is increasing the root EBS volume used by each Elastic Beanstalk instance. In an Elastic Beanstalk application, that is commonly done with an .ebextensions configuration file.

Example:

yaml
1option_settings:
2  aws:autoscaling:launchconfiguration:
3    RootVolumeType: gp3
4    RootVolumeSize: 50

Save that in your source bundle, for example:

text
.ebextensions/storage.config

Then deploy the updated application version. Elastic Beanstalk will apply the configuration to new instances in the environment.

What This Actually Changes

The example above changes the size of the instance root disk from whatever the current default is to 50 GiB. This is useful when your application needs more space for:

  • application artifacts
  • temporary files
  • local caches
  • logs

It is less appropriate if you are storing important application data that should survive instance replacement. Elastic Beanstalk instances are replaceable by design, so persistent data belongs in services such as S3, RDS, EFS, or purpose-built external storage.

Deployment Behavior Matters

Changing the volume definition is not like editing a file on one server. Elastic Beanstalk manages a fleet. To apply the new disk configuration, instances often need to be replaced or relaunched with the new settings.

That means you should think about:

  • rolling deployment behavior
  • environment health during replacement
  • whether a load balancer is present
  • whether anything important is stored only on the local disk

If the environment is single-instance and the app depends on local files, a disk change can expose that design weakness immediately.

Attaching Additional Volumes

Sometimes the root volume is not the right place for large writable storage. In that case, you can define extra block device mappings and mount them during instance provisioning.

For example, a configuration may include both a block device mapping and a command to format and mount the device. The exact device names vary by platform, so the pattern matters more than the literal path names:

yaml
1option_settings:
2  aws:autoscaling:launchconfiguration:
3    BlockDeviceMappings: /dev/sdh=:100
4
5commands:
6  01_format_disk:
7    command: mkfs -t xfs /dev/sdh || true
8  02_mount_disk:
9    command: |
10      mkdir -p /data
11      mount /dev/sdh /data || true

This approach is more complex and needs careful testing because Linux device naming and Elastic Beanstalk platform behavior can differ across generations.

Verify the Result on EC2

After deployment, inspect one instance and verify the new disk size:

bash
lsblk
df -h

Those commands tell you whether:

  • the larger volume exists
  • the filesystem sees the expected capacity
  • the mounted path is the one your application is actually using

Do not stop at "deployment succeeded." Storage changes are only real once the OS and filesystem reflect them.

When Bigger Disk Is the Wrong Fix

Developers often increase instance storage when the actual problem is log retention, build artifacts, or temp-file accumulation. Before raising the volume size, ask:

  • should logs be shipped to CloudWatch Logs
  • should large assets live in S3 instead
  • should temporary data be cleaned up more aggressively

Bigger disks can postpone problems without fixing the root operational issue.

Safer Rollout Pattern

If the environment is production-facing, treat disk changes like any other infrastructure change:

  1. test in a staging environment
  2. verify boot, mount, and application startup
  3. deploy with health monitoring enabled
  4. confirm the new instances really have the expected capacity

Elastic Beanstalk abstracts infrastructure management, but it does not remove the need to verify what happened on the instances.

Common Pitfalls

  • Increasing local instance disk when the real need is persistent shared storage such as S3, RDS, or EFS.
  • Assuming the change updates running instances in place. Disk-size changes often require instance replacement.
  • Forgetting to verify the OS-level disk and filesystem after deployment with tools such as lsblk and df -h.
  • Storing important application state on the instance root volume in an environment where instances are disposable.
  • Jumping to a larger volume before checking whether logs, caches, or temp files should be managed differently.

Summary

  • Increasing Elastic Beanstalk disk capacity usually means changing the EC2 root EBS volume or attaching an extra EBS volume.
  • A common solution is an .ebextensions file with RootVolumeSize.
  • Infrastructure changes typically apply through new or replaced instances, not manual in-place edits.
  • Always verify the resulting disk layout on the instance after deployment.
  • If the application needs durable data, move that data out of the instance filesystem instead of only enlarging the local disk.

Course illustration
Course illustration

All Rights Reserved.