How to use S3 for multimedia storage

Team,

https://commcare-cloud.readthedocs.io/en/latest/services/blobdb/migrate-fs-to-s3.html#ensure-that-the-s3-endpoint-is-up-and-accessible

is this the guide i have to follow to change the storage system of multimedia files ?

when i opened environments//vault.yml it shows numbers only is this correct?

i have changed the localsettings.py in developer commcarehq instance as follows:

from dev_settings import *
#import os
#from storages.backends.s3boto3 import S3Boto3Storage
#from corehq.blobs.s3db import S3BlobDB
####### Database config #######

USE_PARTITIONED_DATABASE = False

Add or update the following settings

S3 Configuration

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
#AWS_ACCESS_KEY_ID = os.getenv('AWS_ACCESS_KEY_ID', 'AKIAQE3RO7SAAK4H2AV3')
#AWS_SECRET_ACCESS_KEY = os.getenv('AWS_SECRET_ACCESS_KEY', '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')
#AWS_STORAGE_BUCKET_NAME = os.getenv('AWS_STORAGE_BUCKET_NAME', 'commcare-bucket')
#AWS_S3_REGION_NAME = os.getenv('AWS_S3_REGION_NAME', 'us-east-1')
#AWS_S3_ENDPOINT_URL = os.getenv('AWS_S3_ENDPOINT_URL', 'https://your-s3-compatible-service.com')
AWS_ACCESS_KEY_ID = 'XXXX'
AWS_SECRET_ACCESS_KEY = 'XXX'
AWS_STORAGE_BUCKET_NAME = 'commcare-bucket'
AWS_S3_REGION_NAME = 'us-east-1'
AWS_S3_ENDPOINT_URL='https://s3.amazonaws.com'

Media settings

#MEDIA_URL = f'https://{AWS_STORAGE_BUCKET_NAME}.{AWS_S3_REGION_NAME}.your-s3-compatible-service.com/media/'
#MEDIA_ROOT = f's3://{AWS_STORAGE_BUCKET_NAME}/media/'

Media settings

MEDIA_URL = 'https://commcare-bucket.s3.amazonaws.com/commcare/'
MEDIA_ROOT = 's3://commcare-bucket/commcare/'

#S3_BLOB_DB_SETTINGS = {

"url": os.getenv('AWS_S3_ENDPOINT_URL', AWS_S3_ENDPOINT_URL),

"access_key": AWS_ACCESS_KEY_ID,

"secret_key": AWS_SECRET_ACCESS_KEY,

#"bucket": AWS_STORAGE_BUCKET_NAME,
#"region": AWS_S3_REGION_NAME,

#}
#BLOB_DB = S3BlobDB(S3_BLOB_DB_SETTINGS)

BlobDB settings

BLOB_DB = {
'default': {
'ENGINE': 'corehq.blob_db.s3db.S3BlobDB',
'BUCKET_NAME': AWS_STORAGE_BUCKET_NAME,
'AWS_ACCESS_KEY_ID': AWS_ACCESS_KEY_ID,
'AWS_SECRET_ACCESS_KEY': AWS_SECRET_ACCESS_KEY,
'AWS_S3_REGION_NAME': AWS_S3_REGION_NAME,
'AWS_S3_ENDPOINT_URL': AWS_S3_ENDPOINT_URL,
'PREFIX': 'commcare/',
}
}
#s3_blob_db_enabled= yes

example partitioned DB set up

if USE_PARTITIONED_DATABASE:

DATABASES.update({
    'proxy': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'commcarehq_proxy',
        'USER': 'commcarehq',
        'PASSWORD': 'commcarehq',
        'HOST': 'localhost',
        'PORT': '5432',
        'TEST': {
            'SERIALIZE': False,
        },
        'PLPROXY': {
            'PROXY': True
        }
    },
    'p1': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'commcarehq_p1',
        'USER': 'commcarehq',
        'PASSWORD': 'commcarehq',
        'HOST': 'localhost',
        'PORT': '5432',
        'TEST': {
            'SERIALIZE': False,
        },
        'PLPROXY': {
            'SHARDS': [0, 1],
        }
    },
    'p2': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'commcarehq_p2',
        'USER': 'commcarehq',
        'PASSWORD': 'commcarehq',
        'HOST': 'localhost',
        'PORT': '5432',
        'TEST': {
            'SERIALIZE': False,
        },
        'PLPROXY': {
            'SHARDS': [2, 3],
        }
    },
})

Modify this value if you are deploying multiple environments of HQ to the same machine.

Identify the target type of this running environment

SERVER_ENVIRONMENT = 'changeme'

####### Less/Django Compressor ########

COMPRESS_ENABLED = False
COMPRESS_OFFLINE = False

####### Misc / HQ-specific Config ########

Set to something like "192.168.1.5:8000" (with your IP address) to enable submitting

data to your local environment from an android phone.

See corehq/apps/builds/README.md for more information.

BASE_ADDRESS = 'localhost:8000'

PREVIEWER_RE = r'^.*@dimagi.com$'

MAPS_LAYERS = {
'Maps': {
'family': 'mapbox',
'args': {
'apikey': ''
}
},
'Satellite': {
'family': 'mapbox',
'args': {
'apikey': '
'
}
},
}

LOCAL_APPS += (

'debug_toolbar', # Adds a retractable panel to every page giving profiling & debugging info

)

LOCAL_MIDDLEWARE = [
# 'debug_toolbar.middleware.DebugToolbarMiddleware',
]

LOCAL_PILLOWTOPS = {

'my_pillows': ['some.pillow.Class', ],

'and_more':

}

when i am running and creating commcare dev instance and uploading the image or audio or video it is not showing to get uploaded inside S3.

@mkangia kindly suggest even though i have followed instructions it is not uplaoding the files into S3 for commcare HQ develoeper code

https://commcare-cloud.readthedocs.io/en/latest/services/blobdb/migrate-fs-to-s3.html#send-new-writes-to-the-s3-endpoint