Skip to main content

Migrating from Drupal 6 to 7 and moving files to Amazon S3, through configuration

Back-end Development
Drupal

A fairly-painless Drupal 6 to 7 upgrade and migration pathway is now available using the Migrate and Drupal-to-Drupal Migrate modules. A new UI wizard simplifies the process, with all the changes being made through configuration without needing to writing custom migration modules or classes. You need to download, install and enable the dev branches on both Migrate and D2D Migrate to use the UI Wizard until D2D Migrate's release branch is on 2.1. Be sure to enable the proper permissions so you'll be able to edit the migration mappings in the configurations.

Note: To migrate your files to Amazon S3, you'll have to setup your file/image fields on your D7 destination nodes using the S3 wrapper instead of the default public:// wrapper. To do so, you'll need these modules:

The D2D Migrate wizard creates and customizes your migration through configuration.

1. Enter your credentials.

The instructions here are straightfoward. Since I am upgrading and migrating a site from D6 to D7 on the same server, I use "localhost" as my database host.

2. Users

In order to map roles from their source role (D6) to their destination role (D7), setup your user roles on the D7 site. Then select which roles you want to be migrated and mapped.

3. Files

There's a field that asks for a file prefix. This is the full directory to where your files are stored on your server for your source migration. An example would be "/var/www/mydrupal6site.com/sites/default/files/". Replace this with the full prefix for wherever your source directory is located on your server.

4. Content Types

Just like in step 2, you'll be selecting which node types you want to migrate and how to map them to their destinations. You will need to setup and configure your content types on your D7 site with the fields you want to maintain. It's best to use the same naming covention for the fields you create on your D7 site so that they match the machine names from your D6 site. If the machine names for the content types match, the Wizard will automatically select the Destination field to correspond to the source type.

Migrating over input formats will require configuration on your D7 to match your D6 configurations. For example if you have a body field that used a WYSIWYG format on your source, you'll need to set the default value to WYSIWYG.

5. Review

Review the configurations you've made through the wizard for your migration. Your new migration will be ready when you return to the migrate dashboard.

I wrestled with the order of which each migration needed to occur before the others. I would recommend importing the files first before importing any nodes. To do so you'll have to edit the files migration and enter in a s3:// as the default value for the "Path within Drupal Files directory to store file". 

Run the files migration and it should run event free unless your AWSSDK credentials or S3 buckets aren't setup properly.

Now for each of your node migrations, you'll have to set each image or file field's default value for the Option: "implementation of MigrateFile to use" to "MigrateFileFid", you can read more on it here.

You should now be able to migrate all of your nodes, with their file/image attachments hosted on Amazon S3.