It seems the steps are as follows (not for .fi domains):
hostname
sudo echo “box.example.com” > /etc/hostname
sudo nano /etc/hosts
==>127.0.0.1 localhost.localdomain localhost
==>your_server_ip box.example.com box
save and close the file
Sign in to the AWS Management Console and open the Amazon Route 53 console at https://console.aws.amazon.com/route53/.
In the navigation pane, choose Registered Domains.
Choose the name of the domain for which you want to edit settings.
Choose Add/Edit Name Servers.
In the Edit Name Servers dialog box, do the following:
update the fields with ns1.box.example.com, ns2.box.example.com, ns3.box.example.com, and ns4.box.example.com to map:
example.com to NS to ns1.box.example.com
example.com to NS to ns2.box.example.com
update each of the four glue boxes with yourserverip to map:
ns1.box.example.com to yourserverip
ns2.box.example.com to yourserverip
see your EC2 instance for your server’s ip. Hint: use an elastic IP.
Wait for Amazon to update the nameservers before you install Mail in a Box. You can confirm the nameservers were updated by using dig, if on Linux.
==>dig example.com MX
==>dig example.com A
==> dig example.com +short
Go to your EC2 instance. Select the security group for your instance. Choose the Inbound tab. Choose edit.
Open ports 22 (SSH), 25 (SMTP), 53 (DNS; must be open for both tcp & udp), 80 (HTTP), 443 (HTTPS), 587 (SMTP submission), 993 (IMAP), 995 (POP) and 4190 (Sieve).
Install Mail in a Box:
==>curl -s https://mailinabox.email/setup.sh | sudo bash