How to boot EC2 with preset hostname?

To just set the hostname (without Route53), you can use cloud-init configuration in the user-data

#cloud-config
hostname: mynode
fqdn: mynode.example.com
manage_etc_hosts: true

You can use the user-data function of the console and/or API to provide a bash script which will be executed on first boot. This script can set the hostname, create a DNS record, and any other actions you desire.