Elastic IP
According to the answer from Shibashis you will be charged:
$0.005 x 24hr x 30 days = $3.60 / months / per Elastic IP address not associated with
DynamicURL
You may consider other option that does not require for an assignment of an Elastic IP.
There is a service called DynamicURL that change IP Address on A of your domain dynamically.
https://ipv4.cloudns.net/api/dynamicURL/?q=XXX...
Some services are free. You need only to set NAME SERVER of your domain.
Following are the example script to run each time an instance is started:
Wget
wget -q --read-timeout=0.0 --waitretry=5 --tries=400 \\
--background https://ipv4.cloudns.net/api/dynamicURL/?q=XXX...
php
<?php file_get_contents('https://ipv4.cloudns.net/api/dynamicURL/?q=XXX...'); ?>
Python
#!/usr/bin/python
import urllib
page = urllib.urlopen("https://ipv4.cloudns.net/api/dynamicURL/?q=XXX...");
page.close();
Perl
#!/usr/bin/perl
my $uri = 'https://ipv4.cloudns.net/api/dynamicURL/?q=XXX...';
use IO::Socket;
my ($domain, $path) = $uri =~ m{^https://([^/]*)(.*)};
$path = '/' unless length $path;
my $sock = IO::Socket::INET->new(
Proto => 'tcp',
PeerAddr => $domain,
PeerPort => '80',
) or die "can't connect to $domain\n";
my $CRLF = "\x{0d}\x{0a}";
print $sock "GET $path HTTP/1.0$CRLF$CRLF";
close($sock);
If you are behind proxy and your real IP is set in the header X-Forwarded-For you need to add &proxy=1 at the end of the DynamicURL.