By default, if you want to setup FQDN for AWS Opsworks instances, you will have problem because in AWS Management console you can't put "your.domain.com", since "dots" (.) are forbidden. This is most likely done because Opsworks wants to control FQDN by itself.

However, most likely you will want to setup your own FQDN for an instance (for example if you are running mail server or similar).

In order to modify instance FQDN, one way is to modify template file which is used for setting up /etc/hosts file:

https://github.com/aws/opsworks-cookbooks/blob/release-chef-11.10/opsworks_stack_state_sync/templates/default/hosts.erb

So basically, in your own custom cookbook repository you need to create exact same directory and template file:

opsworks_stack_state_sync/templates/default/hosts.erb

Now, you can modify that template file to put your domain name, e.g.:


# This file was generated by OpsWorks
# # any manual changes will be removed on the next update.
# # The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
# # OpsWorks Layer State
127.0.0.1 localhost.localdomain localhost
127.0.1.1 <%= @localhost_name %>.localdomain <%= @localhost_name %> <%= @localhost_name %>.cloudhowto.org
<% @nodes.each do |node| -%>
<% if node.attributes.attribute?(:private_ip) && node.attributes.private_ip && Resolv.getaddress(node.attributes.private_ip) -%>
<%= node.attributes.private_ip %> <%= node.name %> <%= node.hostname %>.cloudhowto.org
<% else -%>
<%= "# Unable to resolve IP '#{node.attributes.private_ip}' for hostname '#{node.name}'" %>
<% end -%>
<% if node.attributes.attribute?(:ip) && node.attributes.ip && Resolv.getaddress(node.attributes.ip) -%>
<%= node.attributes.ip %> <%= node.name %>-ext <%= node.hostname %>-ext.cloudhowto.org
<% else -%>
<%= "# Unable to resolve IP '#{node.attributes.ip}' for hostname '#{node.name}'" %>
<% end -%>
<% end -%>

After this, you can execute your custom cookbook recipe by:

opsworks_stack_state_sync::hosts

More useful info:

http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-template-override.html