I've been reading on AmazonWS that you use cname to use their webservices. Is CNAME when i have a file like this sarah.example.com/image/2001.jpg and then it really is at blablabla.com/mybucket/sarah/image/2001.jpg ? but the web user doesnt know this? he sees the url adress as in example.com?
CNAME is used in DNS Name Resolution It simply tells the resolver to use the IP of another Domain Name that is already defined. It is nothing more as an alias, see also Justice's answer and the definition.
But it is not exchanged in the URL, the CNAME record is only used to lookup the IP of sarah.example.com, and the original url is then used.
In your example it would be:
When the client is requesting http://sarah.example.com/image/2001.jpg, he first looks up the IP for sarah.example.com. The client asks a nameserver, and the nameserver sees a CNAME record in the DNS entry for sarah.example.com that tells him to use the IP of blablabla.com let's say it is 10.10.10.10, so the nameserver returns 10.10.10.10 to the client.
The Client now uses the original url sarah.example.com/image/2001.jpg and requests it from the web server at 10.10.10.10
In the DNS entry for example.com there would somewhere be a line like:
sarah 3600 IN A 10.10.10.10
In the DNS entry for blablabla.com:
blablabla.com. 3600 IN CNAME sarah.example.com.
A CNAME record or Canonical Name record is a type of resource record in the Domain Name System (DNS) that specifies that the domain name is an alias of another, canonical domain name. This helps when running multiple services (like an FTP and a webserver; each running on different ports) from a single IP address. Each service can then have its own entry in DNS (like ftp.example.com. and www.example.com.). Network administrators also use CNAMEs when running multiple HTTP servers on the same port, with different names, on the same physical host.
For more information you might be interested in some of the related RFCs.
- RFC1034 - Domain names - concepts and facilities
- RFC1035 - Domain names - implementation and specification
RFC 1034 says "CNAME identifies the canonical name of an alias." In simple terms a
CNAME is just an alias for a domain name, like a symbolic link to a file.