An Easy Way To Migrate Emails To The Amazon Workmail

Have you decided to move your resources to AWS? Resources are not only about storage or anything to build your application, right? Something you use to communicate with your customers or business partners is also an important thing. Amazon Workmail is …


This content originally appeared on DEV Community and was authored by Nurul Ramadhona

Have you decided to move your resources to AWS? Resources are not only about storage or anything to build your application, right? Something you use to communicate with your customers or business partners is also an important thing. Amazon Workmail is the answer for our email service.

Amazon Workmail

I've created some posts in this series but those are for something built from scratch. Then, I thought what if we want to migrate our emails from the current hosting provider to AWS. So in this section, I'll show you the easy way that AWS already provided at no cost. Actually there are two migration specialists we can use but here I choose one of them which it doesn't require us to install anything. It's a web-based so we can easily access it anywhere. We'll use audriga.

audriga

Before we migrate, we need to do a few things "carefully" because the state of our domain or the email itself is in use. So, these are the steps I created to do before we migrate all emails.

  1. Announce your migration schedule a few days before you do that to the all email's users and tell them the next steps they should do after the migration process has done, such as change the default password, etc.
  2. Start to create the Amazon Workmail resources, consist of an organization, some users along with the emails as the target and an administrator (I'll tell you what it's used for later).
  3. I suggest you to do the migration at the time when the users are not actively using their emails like in the midnight for example as we usually do for maintenance.
  4. Set the required DNS records provided by AWS except the MX record. But if there is no more email transaction at that time, you can go ahead for all records.
  5. Start to migrating the emails.

Since I don't have email hosted somewhere, I'll do two types of migration. First is manual migration from Outlook to Workmail. Then, the second one is batch migration between two Workmail organizations (here we'll also can see how to migrate either from or to Workmail).

Now we are ready to go!

Create The Amazon Workmail Resources

On this step, we just need to create an organization along with registering the external domain. Here I use domain dhona.xyz.

$ aws workmail create-organization --alias dhona --domains DomainName=dhona.xyz --region us-east-1

Note*: it's not mandatory to use external domain since AWS gives us a domain alias for each organization subdomain.awsapps.com.

Set The Required DNS Records

Please set the DNS records generated by Workmail and make sure all are verified.

$ aws workmail get-mail-domain --domain-name dhona.xyz --organization-id m-44968df215c443dea726cd731821614a --region us-east-1
DkimVerificationStatus: PENDING
IsDefault: false
IsTestDomain: false
OwnershipVerificationStatus: PENDING
Records:
(the record will be shown here)

Once we set the DNS properly, it should be successfully verified.

Domain Verification

Start The Migration Process

1. Manual Migration

This method we can use to migrate single email or only for a few users (small quantities). So as the beginning, we'll create one email user as the target of the Outlook's email.

$ aws workmail create-user --organization-id m-44968df215c443dea726cd731821614a --name dhonaxyz --display-name "Nurul Ramadhona" --password $password --region us-east-1
$ aws workmail register-to-work-mail --organization-id m-44968df215c443dea726cd731821614a --entity-id bdb219b2-c7ed-4c0e-8e04-293b5bd69127 --email dhonaxyz@dhona.xyz --region us-east-1
$ aws workmail describe-user --user-id bdb219b2-c7ed-4c0e-8e04-293b5bd69127 --organization-id m-44968df215c443dea726cd731821614a --region us-east-1
DisplayName: Nurul Ramadhona
Email: dhonaxyz@dhona.xyz
EnabledDate: '2023-03-26T12:52:35.822000+07:00'
Name: dhonaxyz
State: ENABLED
UserId: bdb219b2-c7ed-4c0e-8e04-293b5bd69127
UserRole: USER

As I mentioned above, we'll use audriga. Here are the steps of how to use it:

audriga 1

  • Select the provider (source and target).

audriga 2

  • Enter the email account details (source and target). Because we migrate in user mode, we should enter the email and password manually. Make sure both passed the validation checks.

audriga 3

  • Start the migration (we can leave the screen because we'll get email notification once the migration has configured, started and completed).

audriga 4

audriga 5

  • Check if the emails are exist on the target email (the source email currently has two emails, each one email on Inbox and Sent Items).

outlook workmail

outlook inbox

outlook sent

2. Batch migration

We have successfully migrate single account. That's good, right? But what if we have a large number of users? Should we migrate all one-by-one?

Don't worry! We can use a template file (usually in .csv) for uploading the users details. This is a common thing for managing email service.

Since we'll do batch migration. Please create some target users along with the emails on the Workmail. Make sure all users are created and enabled. You can use the following ansible playbook I created:

- name: workmail-users
  hosts: localhost
  connection: local
  gather_facts: no

  tasks:
    - name: create users
      command: aws workmail create-user --organization-id your-org-id --name "{{ item.username }}" --display-name "{{ item.fullname }}" --password "{{ item.pass }}" --region your-choosen-region
      loop: 
         - { username: "user1", pass: "passwordup2U!", fullname: "User 1"}
         - { username: "user2", pass: "passwordup2U!", fullname: "User 2"}
         - { username: "user3", pass: "passwordup2U!", fullname: "User 3"}
         - { username: "user4", pass: "passwordup2U!", fullname: "User 4"}
         - { username: "user5", pass: "passwordup2U!", fullname: "User 5"}
      tags: [create]

    - name: list users
      shell: "aws workmail list-users --organization-id your-org-id --region your-choosen-region --query 'Users[?Name==`{{ item.username }}`].Id' >> id-list.txt"
      loop: 
         - { username: "user1" }
         - { username: "user2" }
         - { username: "user3" }
         - { username: "user4" }
         - { username: "user5" }
      tags: [list]

    - name: list users id
      shell: 'cat id-list.txt'
      register: list_id
      tags: [list]

    - debug:
        var: list_id.stdout_lines
      tags: [list]

    - name: enable users
      command: aws workmail register-to-work-mail --organization-id your-org-id --entity-id "{{ item.userid }}" --email "{{ item.email }}" --region your-choosen-region
      loop: 
         - { userid: "user1id", email: "user1@your.domain" }
         - { userid: "user2id", email: "user2@your.domain" }
         - { userid: "user3id", email: "user3@your.domain" }
         - { userid: "user4id", email: "user4@your.domain" }
         - { userid: "user5id", email: "user5@your.domain" }
      tags: [enable]

Note*: please enter the value with your own user's details as well as the amount of users. Then, run the 'enable' tag separately as we need the entity-id values after the 'create' and 'list' tags.

Here I create 5 users as example:

workmail target users

We also need to enable migration permission and choose an administrator. By using administrator, we can migrate all emails without providing each user's password. Yes, we only use the credential of the administrator as it has access to all users.

workmail migration administrator

Then, because I migrate between two Workmail organizations. I'll create one more organization as I do for the target organization. I'll migrate from nurul.awsapps.com to dhona.xyz which both are hosted on Workmail. But if you already have emails hosted somewhere, you don't need to do this.

Now, we are ready to migrate the emails! The steps are similar with the manual migration above, so here I'll mention the difference between them:

  • Select the provider (source and target). Because I'll do migration between two Workmail organizations, I choose the same source and target provider. In case the source (your current email service) is hosted somewhere, please choose add missing provider or server and enter the details needed.

audriga 6

audriga 7

  • Configure account by choosing add multiple accounts, then upload the .csv file. Here's the example:

audriga 8

audriga 9

audriga 10

audriga 11

  • Start the migration.

audriga 12

audriga 13

  • Check the email. Here before I did migration, I sent a test email to all source emails. As we can see above there are 5 accounts have been migrated and each contains 1 email. Then, I'll login to one of those five users to see if the email is exist.

audriga 14

audriga 15

That's it! It's very easy, right? AWS has provide us the easy way and the self-service as well, so we can do it independently anytime we need to migrate to Amazon Workmail.

Alright! Last but not least, don't forget to follow me for more content! Thank you!


This content originally appeared on DEV Community and was authored by Nurul Ramadhona


Print Share Comment Cite Upload Translate Updates
APA

Nurul Ramadhona | Sciencx (2023-03-27T03:40:33+00:00) An Easy Way To Migrate Emails To The Amazon Workmail. Retrieved from https://www.scien.cx/2023/03/27/an-easy-way-to-migrate-emails-to-the-amazon-workmail/

MLA
" » An Easy Way To Migrate Emails To The Amazon Workmail." Nurul Ramadhona | Sciencx - Monday March 27, 2023, https://www.scien.cx/2023/03/27/an-easy-way-to-migrate-emails-to-the-amazon-workmail/
HARVARD
Nurul Ramadhona | Sciencx Monday March 27, 2023 » An Easy Way To Migrate Emails To The Amazon Workmail., viewed ,<https://www.scien.cx/2023/03/27/an-easy-way-to-migrate-emails-to-the-amazon-workmail/>
VANCOUVER
Nurul Ramadhona | Sciencx - » An Easy Way To Migrate Emails To The Amazon Workmail. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/03/27/an-easy-way-to-migrate-emails-to-the-amazon-workmail/
CHICAGO
" » An Easy Way To Migrate Emails To The Amazon Workmail." Nurul Ramadhona | Sciencx - Accessed . https://www.scien.cx/2023/03/27/an-easy-way-to-migrate-emails-to-the-amazon-workmail/
IEEE
" » An Easy Way To Migrate Emails To The Amazon Workmail." Nurul Ramadhona | Sciencx [Online]. Available: https://www.scien.cx/2023/03/27/an-easy-way-to-migrate-emails-to-the-amazon-workmail/. [Accessed: ]
rf:citation
» An Easy Way To Migrate Emails To The Amazon Workmail | Nurul Ramadhona | Sciencx | https://www.scien.cx/2023/03/27/an-easy-way-to-migrate-emails-to-the-amazon-workmail/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.