Amazon ElastiCache
Getting Started Guide (API Version 2012-11-15)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Connect to a Cache Node

Connect to Cache Cluster

Important

This section assumes that you've created an Amazon EC2 instance and can connect to it. For instructions on how to do this, please go to the Amazon EC2 Getting Started Guide.

Once you've authorized access to the cache cluster using the AWS Management Console and your cache cluster is in the available state, you can connect to a cache node in the cache cluster.

Important

You can only connect to a cache node from an EC2 instance that belongs to the EC2 Security Group that you authorized in the Authorize Access section.

In the following example, you use the telnet utility to connect to the cache cluster you just created.

Note

For more information about Memcached and available Memcached commands, go to http://memcached.org.

To connect to a cache cluster using telnet

  1. Find the endpoint of the cache node you want to connect to.

    1. On the My Cache Clusters page of the AWS Management Console, click the name of a cache cluster.

      The detail page for the cache cluster appears.

    2. Click the Nodes tab at the top of the window.

    3. On the Nodes tab of the detail window, note the endpoint of a cache cluster to use in the next step.

      Note

      The endpoint for your cache cluster isn't available until your cache cluster is in the available state.

      Console home

  2. Connect to your Amazon EC2 instance using the connection utility of your choice.

    Note

    For instructions on how to do this, please go to the Amazon EC2 Getting Started Guide.

  3. On your EC2 instance, open a command prompt and enter the following command; make sure to use the endpoint of the cache cluster you created.

    PROMPT> telnet myfirstcacheinstance.evdfes.0001.use1.cache.amazonaws.com 11211

    You will see output similar to the following.

    Trying 128.0.0.1...
    Connected to myfirstcacheinstance.evdfes.0001.use1.cache.amazonaws.com.
    Escape character is '^]'.
    >

    You are now connected to a cache node and may run Memcached commands. For example:

    set a 0 0 5			// Set key “a” with no expiration and 5 byte value
    hello				// Set value as “hello”
    STORED
    get a				// Get value for key “a”
    VALUE a 0 5
    hello
    END
    get b				// Get value for key “b” results in cache miss
    END
    >

Once you're finished with your new cache cluster, make sure to delete it to avoid incurring further usage charges. Click the following button.

Get started