Ace Cloud Interviews
💻

AWS End User Computing

WorkMail

Managed business email and calendar service compatible with Outlook and mobile apps

Amazon WorkMail is a managed business email and calendar service that provides Microsoft Exchange-compatible email, contacts, and calendar functionality without managing Exchange servers. It supports native Outlook connectivity (via MAPI/EWS), ActiveSync for mobile devices, and the WorkMail web application - and integrates with other AWS services for spam filtering, encryption, and email flow customization through Lambda hooks.

How WorkMail Works: Organization, Users, and Mail Flow

WorkMail is organized around the concept of an Organization, which maps to an email domain. Each organization has an associated AWS directory (Managed AD, Simple AD, or an existing directory) and mailboxes for users and groups.

ConceptDescription
OrganizationTop-level container. Maps to your email domain (e.g. company.com). Created per AWS region.
User MailboxEmail + calendar + contacts for a single user. Counts toward billing.
GroupDistribution list. Emails to the group are forwarded to all members. No storage.
ResourceRoom or equipment mailboxes (conference rooms, projectors) with booking rules.
AliasAdditional email addresses for a user or group that resolve to the same mailbox.
DomainVerified domain with DNS records (MX, SPF, DKIM, DMARC) pointing to WorkMail.

Inbound mail flows: external sender -> WorkMail MX endpoint -> (optional Lambda inbound hook) -> recipient mailbox. Outbound mail flows: user sends -> (optional Lambda outbound hook) -> WorkMail SMTP -> (optional SES for sending) -> internet.

💡

WorkMail uses AWS SES under the hood for sending email. When you verify a domain in WorkMail, the DNS records (SPF, DKIM) are provided by SES and reference SES infrastructure. This means your sending reputation is tied to the us-east-1 SES service.

Domain Setup and Required DNS Records

Setting up a domain in WorkMail requires adding several DNS records to route mail correctly and improve deliverability. Missing or incorrect records are the most common reason for deliverability issues.

DNS RecordTypePurposeExample Value
MXMXRoute inbound mail to WorkMailinbound-smtp.us-east-1.amazonaws.com priority 10
SPFTXTAuthorize WorkMail to send on your behalf"v=spf1 include:amazonses.com ~all"
DKIMCNAME x3Cryptographically sign outbound mailWorkMail provides 3 CNAME records to add
DMARCTXTPolicy for handling SPF/DKIM failures"v=DMARC1; p=quarantine; rua=mailto:dmarc@yourdomain.com"
AutoDiscoverCNAMEOutlook auto-configurationautodiscover.mail.us-east-1.awsapps.com
⚠️

If you do not add DMARC, inbound mail to other services may be quarantined even if SPF and DKIM pass, because many receivers now require DMARC. Always configure DMARC with at least p=none (monitoring mode) before switching to quarantine or reject.

bash
# Verify a domain for WorkMail via CLI
aws workmail create-organization \
  --alias mycompany \
  --directory-id d-9067abc123

# Register a domain with an organization
aws workmail register-mail-domain \
  --organization-id m-abc12345678 \
  --domain-name mycompany.com

# Get the DNS records needed for the domain
aws workmail get-mail-domain \
  --organization-id m-abc12345678 \
  --domain-name mycompany.com

Client Connectivity: Outlook, Mobile, and Web

WorkMail supports multiple connection protocols that map to different client types.

ProtocolClientPortNotes
MAPI/HTTP (EWS)Outlook for Windows and macOS443Recommended for desktop. Supports full Exchange features.
ActiveSynciOS Mail, Android Gmail, Outlook Mobile443Mobile device synchronization of email, calendar, contacts.
IMAPAny IMAP client (Thunderbird, Apple Mail)993Email only - no calendar or contacts sync.
SMTPAny SMTP client for sending465 (SSL)Requires WorkMail user credentials for authentication.
WorkMail Web AppBrowser (Chrome, Firefox, Edge)443Full-featured web client at workmail.amazonaws.com.

Outlook auto-discovery uses the AutoDiscover CNAME record to automatically configure server settings. When a user adds their WorkMail email address to Outlook, Outlook queries the AutoDiscover endpoint and receives the MAPI/HTTP connection settings without manual configuration.

💡

WorkMail does not support Outlook for Windows via legacy MAPI (RPC over HTTP). It uses the modern MAPI over HTTP protocol. Outlook 2013 SP1 or later is required. Very old Outlook versions (2010 and earlier) only work via IMAP.

Email Flow Rules and Lambda Integration

Email flow rules let you intercept and process email at the organization level using Lambda functions. This enables custom spam filtering, compliance archiving, content inspection, and routing logic without modifying the mail server.

Rule TypeTrigger PointLambda Actions Available
Inbound ruleBefore message is delivered to mailboxPASS, DROP, BOUNCE, DEFAULT (WorkMail default handling)
Outbound ruleBefore message is sent externallyPASS, DROP, DEFAULT
bash
# Lambda function handler for WorkMail inbound processing
import boto3
import json

def handler(event, context):
    # event contains: messageId, invocationId, flowDirection, truncated
    message_id = event['messageId']
    
    # Retrieve the raw email message
    workmail = boto3.client('workmailmessageflow')
    response = workmail.get_raw_message_content(
        messageId=message_id
    )
    raw_message = response['messageContent'].read()
    
    # Inspect content - example: block messages with specific subject
    if b'URGENT WIRE TRANSFER' in raw_message:
        return {'actions': [{'action': {'type': 'DROP'}}]}
    
    return {'actions': [{'action': {'type': 'DEFAULT'}}]}
💡

Lambda-based email flow rules are powerful for compliance use cases. A common pattern is routing a copy of all outbound emails to an S3 bucket for archiving while still passing the original message through. Use workmailmessageflow.put_raw_message_content() to modify messages before delivery.

Security: Encryption, Access Control, and Mobile Policies

WorkMail encrypts all mailbox data at rest using KMS and in transit using TLS. Additional security features control mobile device access and email client behavior.

Security FeatureDescriptionConfiguration
KMS EncryptionAll mailbox data encrypted at rest with customer-managed or AWS-managed KMS keySet at organization creation - cannot change later
Mobile Device PoliciesEnforce PIN, remote wipe, encryption on ActiveSync devicesConfigurable per user or organization-wide
Email Impersonation RolesAllow applications to send on behalf of users without their passwordGrant impersonation role to IAM user/role for the mailbox
S3-based archivingJournaling via email flow rules to S3 for complianceRequires Lambda email flow rule + S3 destination
Access Control RulesBlock or allow specific protocols (IMAP, ActiveSync) per user or IP rangeOrganization-level access control rules
bash
# Create an access control rule to block IMAP for all users
aws workmail put-access-control-rule \
  --organization-id m-abc12345678 \
  --name BlockIMAPAll \
  --effect DENY \
  --description "Block IMAP access org-wide" \
  --ip-ranges "0.0.0.0/0" \
  --actions IMAP

# Allow ActiveSync only from corporate IP range
aws workmail put-access-control-rule \
  --organization-id m-abc12345678 \
  --name AllowActiveSyncCorporate \
  --effect ALLOW \
  --description "ActiveSync from corporate network only" \
  --ip-ranges "203.0.113.0/24" \
  --actions ActiveSync
⚠️

If you disable IMAP or ActiveSync org-wide via access control rules, existing users who rely on those protocols will immediately lose access. Test on a pilot group before rolling out access control changes broadly.

Pricing Model and Migration Considerations

WorkMail pricing is per-user per-month with a flat rate that includes storage. There are no data transfer charges for email sent within AWS services.

ComponentPrice
User mailbox$4/user/month - includes 50 GB mailbox storage
Additional storage$0.023/GB/month beyond 50 GB per user
Test messages (SES)Included - WorkMail uses SES for sending at no additional charge
Lambda invocations for email rulesStandard Lambda pricing per invocation and GB-second

Migrating to WorkMail from Exchange or Office 365 typically involves exporting mailboxes as PST files and importing them via the WorkMail Migration Tool, or using a third-party migration tool that supports IMAP migration. For large migrations, AWS recommends using the WorkMail Migration API which supports delta syncs.

💡

WorkMail can coexist with an existing Exchange environment during migration using mail flow rules that route email for migrated users to WorkMail while keeping non-migrated users on Exchange. This allows a phased migration without disrupting email flow.

ComparisonWorkMailMicrosoft 365 Exchange OnlineSelf-hosted Exchange
Cost$4/user/month$6-12/user/month (Business Basic-Standard)License + hardware + admin labor
Storage50 GB/user50-100 GB/userLimited by storage hardware
ComplianceVia Lambda + S3 archivingBuilt-in litigation hold, eDiscoveryRequires add-on products
AWS IntegrationNative (SES, Lambda, KMS, CloudTrail)Via connectors/APIsManual integration
Outlook SupportMAPI/HTTP, EWSFull native supportFull native support
🎯

Interview Focus Points

  • 1What DNS records are required to set up WorkMail for a domain, and what does each one do for deliverability?
  • 2How would you use Lambda email flow rules to implement compliance archiving for all outbound email?
  • 3A company is migrating from Office 365 to WorkMail. How would you execute a phased migration without disrupting mail flow?
  • 4How does WorkMail handle email encryption at rest, and can you bring your own KMS key?
  • 5An organization wants to restrict email access to corporate devices only. What WorkMail features would you use?
  • 6Explain how Outlook auto-discovery works with WorkMail and what can go wrong during configuration.
  • 7How does WorkMail compare in cost and features to Microsoft 365 for a 200-person company standardized on AWS?
  • 8What are impersonation roles in WorkMail and when would a cloud engineer configure them?
  • 9How would you set up a shared calendar resource (conference room) in WorkMail with booking rules?