AWS Elastic Beanstalk
Developer Guide

Using Elastic Beanstalk with Amazon S3

Amazon Simple Storage Service (Amazon S3) provides highly durable, fault-tolerant data storage. Behind the scenes, Amazon S3 stores objects redundantly on multiple devices across multiple facilities in an AWS Region.

Elastic Beanstalk creates an Amazon S3 bucket named elasticbeanstalk-region-account-id for each region in which you create environments. Elastic Beanstalk uses this bucket to store objects required for the proper operation of your application.

Contents of the Elastic Beanstalk Amazon S3 Bucket

The following table lists some objects that Elastic Beanstalk stores in your elasticbeanstalk-* Amazon S3 bucket. The table also shows which objects have to be deleted manually. To avoid unnecessary storage costs, and to ensure that personal information isn't retained, be sure to manually delete these objects when you no longer need them.

Object When stored? When deleted?

Application versions

When you create an environment or deploy your application code to an existing environment, Elastic Beanstalk stores an application version in Amazon S3 and associates it with the environment.

During application deletion, and according to Version Lifecycle.

Source bundles

When you upload a new application version using the Elastic Beanstalk console or the EB CLI, Elastic Beanstalk stores a copy of it in Amazon S3, and sets it as your environment's source bundle.

Manually. When you delete an application version, you can choose Delete versions from Amazon S3 to also delete the related source bundle. For details, see Managing Application Versions.

Custom platforms

When you create a custom platform, Elastic Beanstalk temporarily stores related data in Amazon S3.

Upon successful completion of the custom platform's creation.

Log files

You can request Elastic Beanstalk to retrieve instance log files (tail or bundle logs) and store them in Amazon S3. You can also enable log rotation and configure your environment to publish logs automatically to Amazon S3 after they are rotated.

Tail and bundle logs: 15 minutes after they are created.

Rotated logs: Manually.

Saved configurations



Deleting Objects in the Elastic Beanstalk Amazon S3 Bucket

When you terminate an environment or delete an application, Elastic Beanstalk deletes most related objects from Amazon S3. To minimize storage costs of a running application, routinely delete objects that your application doesn't need. In addition, pay attention to objects that you have to delete manually, as listed in Contents of the Elastic Beanstalk Amazon S3 Bucket. To ensure that private information isn't unnecessarily retained, delete these objects when you don't need them anymore.

  • Delete application versions that you don't expect to use in your application anymore. When you delete an application version, you can select Delete versions from Amazon S3 to also delete the related source bundle—a copy of your application's source code and configurations files, which Elastic Beanstalk uploaded to Amazon S3 when you deployed an application or uploaded an application version. To learn how to delete an application version, see Managing Application Versions.

  • Delete rotated logs that you don't need. Alternatively, download them or move them to Amazon Glacier for further analysis.

  • Delete saved configurations that you aren't going to use in any environment anymore.

Deleting the Elastic Beanstalk Amazon S3 Bucket

Elastic Beanstalk applies a bucket policy to buckets it creates to allow environments to write to the bucket and prevent accidental deletion. If you need to delete a bucket that Elastic Beanstalk created, first delete the bucket policy from the Permissions section of the bucket properties in the Amazon S3 console.


If you delete a bucket that Elastic Beanstalk created in your account, and you still have existing applications and running environments in the corresponding region, your applications might stop working correctly. For example:

  • When an environment scales out, Elastic Beanstalk should be able to find the environment's application version in the Amazon S3 bucket and use it to start new Amazon EC2 instances.

  • When you create a custom platform, Elastic Beanstalk uses temporary Amazon S3 storage during the creation process.

We recommend that you delete specific unnecessary objects from your Elastic Beanstalk Amazon S3 bucket, instead of deleting the entire bucket.

To delete an Elastic Beanstalk storage bucket (console)

  1. Open the Amazon S3 console

  2. Open the Elastic Beanstalk storage bucket's page by choosing the bucket name.

            Opening a bucket's page on the Amazon S3 console
  3. Choose the Permissions tab.

  4. Choose Bucket Policy.

  5. Choose Delete.

            Bucket policy editor on the Amazon S3 console
  6. Go back to the Amazon S3 console's main page, and then select the Elastic Beanstalk storage bucket by clicking its line anywhere outside of the bucket name.

            Selecting a bucket on the Amazon S3 console
  7. Choose Delete Bucket.

  8. Type the name of the bucket, and then choose Confirm.