I'm looking for some way to mount a S3 Storage Bucket (for example) as Docker volume in an Elastic Beanstalk Docker Container.
Since i can't change the application code, i have to configure that part in the Dockerrun.aws.json file using Docker volumes.
I need to mount a file for a single configuration file and a volume for a file directory in my application.
Here's my Dockerrun.aws.json file.
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "app"
},
"Ports": [
{
"ContainerPort": 8080,
"HostPort" : 80
}
],
"environment": [
{
"name": "app_DB_MYSQL",
"value": ""
},
{
"name": "app_DB_USERNAME",
"value": "app"
},
{
"name": "app_DB_PASSWORD",
"value": ""
},
{
"name": "app_DB_DATABASE",
"value": "app"
}
],
"volumes": [
{
"HostDirectory": "files",
"containerPath": "/usr/src/app/files",
},
{
"HostDirectory": "configuration.yaml",
"containerPath": "/usr/src/app/config/configuration.yaml",
}
],
"Logging": "/var/log",
}
For persistent storage Elastic Beanstalk with Amazon Elastic File System is generally used:
Sample storage-efs-mountfilesystem.config extract:
option_settings:
aws:elasticbeanstalk:application:environment:
FILE_SYSTEM_ID: 'fs-REPLACE_THIS_WITH_ID!'
MOUNT_DIRECTORY: '/efs'
Sample Dockerrun.aws.json extract:
"Volumes": [
{
"HostDirectory": "/efs/app",
"ContainerDirectory": "/usr/src/app",
}