ElastiCache 전송 중 암호화 (TLS) - 아마존 ElastiCache

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

ElastiCache 전송 중 암호화 (TLS)

데이터를 안전하게 유지하기 위해 Amazon ElastiCache 및 Amazon EC2는 서버의 데이터에 대한 무단 액세스를 방지하는 메커니즘을 제공합니다. 전송 중 암호화 기능을 제공함으로써 데이터가 한 위치에서 다른 위치로 이동할 때 데이터를 보호하는 데 사용할 수 있는 도구를 ElastiCache 제공합니다.

모든 서버리스 캐시에는 전송 중 암호화가 활성화되어 있습니다. 자체 설계된 클러스터의 경우 CreateCacheCluster(CLI: create-cache-cluster) 작업을 사용하여 캐시 클러스터를 생성할 때 TransitEncryptionEnabled 파라미터를 true(CLI: --transit-encryption-enabled)로 설정하여 캐시 클러스터에서 전송 중 암호화를 활성화할 수 있습니다.

전송 중 데이터 암호화 개요

Amazon ElastiCache 전송 중 암호화는 데이터가 한 위치에서 다른 위치로 전송될 때 가장 취약한 시점에서 데이터의 보안을 강화할 수 있는 기능입니다. 엔드포인트에서 데이터를 암호화 및 해독하기 위해 몇 가지 처리가 필요하기 때문에 전송 중 데이터 암호화를 활성화하면 성능에 어느 정도 영향이 있을 수 있습니다. 사용 사례에 대한 성능 영향을 파악하기 위해서는 전송 중 데이터 암호화를 사용한 상태와 사용하지 않은 상태에서 데이터를 벤치마크해야 합니다.

ElastiCache 전송 중 암호화는 다음 기능을 구현합니다.

  • 암호화된 클라이언트 연결 - 캐시 노드에 대한 클라이언트 연결은 TLS로 암호화됩니다.

  • 암호화된 서버 연결 - 클러스터의 노드 간에 이동하는 데이터는 암호화됩니다.

  • 서버 인증 - 클라이언트가 자신이 올바른 서버에 연결 중임을 인증할 수 있습니다.

전송 중 데이터 암호화 조건

자체 설계된 클러스터 구현을 계획할 때는 Amazon ElastiCache 전송 중 암호화에 대한 다음과 같은 제약 조건을 염두에 두어야 합니다.

  • 전송 중 데이터 암호화는 Memcached 버전 1.6.12 이상 버전을 실행 중인 클러스터에서 지원됩니다.

  • 전송 중 암호화는 전송 계층 보안(TLS) 버전 1.2 및 1.3을 지원합니다.

  • 전송 중 데이터 암호화는 Amazon VPC에서 실행 중인 클러스터에 대해서만 지원됩니다.

  • M1, M2, M3, R3, T2 노드 유형을 실행하는 복제 그룹에는 전송 중 암호화가 지원되지 않습니다.

    자세한 정보는 지원되는 노드 유형을 참조하세요.

  • 전송 중 데이터 암호화는 TransitEncryptionEnabled 파라미터를 명시적으로 true로 설정해 활성화합니다.

  • 클러스터를 생성하는 경우에만 클러스터에서 전송 중 데이터 암호화를 사용 설정할 수 있습니다. 클러스터를 수정하여 전송 중 데이터 암호화 켜기 및 끄기를 전환할 수 없습니다.

  • 캐시 클라이언트가 TLS 연결을 지원하고 클라이언트 구성에서 TLS 연결을 활성화합니다.

전송 중 데이터 암호화 모범 사례

  • 엔드포인트에서 데이터를 암호화 및 해독하기 위해 처리가 필요하기 때문에 전송 중 데이터 암호화를 구현하면 성능이 저하될 수 있습니다. 이러한 암호화가 구현 성능에 미치는 영향을 확인하려면 전송 중 데이터 암호화와 데이터를 암호화하지 않은 경우를 비교해 벤치마크하세요.

  • 새로운 연결을 생성하면 비용이 높아질 수 있기 때문에 TLS 연결을 지속해 전송 중 데이터 암호화가 성능에 미치는 영향을 줄일 수 있습니다.

전송 중 데이터 암호화 사용 설정

AWS 관리 콘솔을 사용하여 Memcached 클러스터를 생성하는 경우 전송 중 데이터 암호화를 사용 설정하려면 다음을 선택합니다.

  • 엔진으로 Memcached를 선택합니다.

  • 엔진 버전 1.6.12 이상을 선택합니다.

  • Encryption in transit(전송 중 데이터 암호화)에서 Enable(사용 설정)을 선택합니다.

step-by-step 프로세스에 대한 자세한 내용은 Memcached 클러스터 생성 (콘솔) 을 참조하십시오.

Openssl을 사용하여 전송 중 데이터 암호화가 사용 설정된 노드에 연결

전송 중 암호화가 활성화된 Memcached 노드의 데이터에 액세스하려면 SSL (Secure Socket Layer) 을 사용하는 클라이언트를 사용해야 합니다. ElastiCache 또한 Amazon Linux 및 Amazon Linux 2에서 Openssl s_client를 사용할 수 있습니다.

Openssl s_client를 사용하여 Amazon Linux 2 또는 Amazon Linux에서 전송 중 데이터 암호화가 사용 설정된 Memcached 클러스터에 연결하려면 다음을 수행합니다.

/usr/bin/openssl s_client -connect memcached-node-endpoint:memcached-port

Java를 사용하여 TLS Memcached 클라이언트 생성

TLS 모드로 클라이언트를 생성하려면 다음을 수행하여 적절한 SSLContext를 통해 클라이언트를 초기화합니다.

import java.security.KeyStore; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; import net.spy.memcached.AddrUtil; import net.spy.memcached.ConnectionFactoryBuilder; import net.spy.memcached.MemcachedClient; public class TLSDemo { public static void main(String[] args) throws Exception { ConnectionFactoryBuilder connectionFactoryBuilder = new ConnectionFactoryBuilder(); // Build SSLContext TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init((KeyStore) null); SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, tmf.getTrustManagers(), null); // Create the client in TLS mode connectionFactoryBuilder.setSSLContext(sslContext); MemcachedClient client = new MemcachedClient(connectionFactoryBuilder.build(), AddrUtil.getAddresses("mycluster.fnjyzo.cfg.use1.cache.amazonaws.com:11211")); // Store a data item for an hour. client.set("theKey", 3600, "This is the data value"); } }

PHP를 사용하여 TLS Memcached 클라이언트 생성

TLS 모드로 클라이언트를 생성하려면 다음을 수행하여 적절한 SSLContext를 통해 클라이언트를 초기화합니다.

<?php /** * Sample PHP code to show how to create a TLS Memcached client. In this example we * will use the Amazon ElastiCache Auto Descovery feature, but TLS can also be * used with a Static mode client. * See Using the ElastiCache Cluster Client for PHP (https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/AutoDiscovery.Using.ModifyApp.PHP.html) for more information * about Auto Discovery and persistent-id. */ /* Configuration endpoint to use to initialize memcached client. * this is only an example */ $server_endpoint = "mycluster.fnjyzo.cfg.use1.cache.amazonaws.com"; /* Port for connecting to the cluster. * This is only an example */ $server_port = 11211; /* Initialize a persistent Memcached client and configure it with the Dynamic client mode */ $tls_client = new Memcached('persistent-id'); $tls_client->setOption(Memcached::OPT_CLIENT_MODE, Memcached::DYNAMIC_CLIENT_MODE); /* Add the memcached's cluster server/s */ $tls_client->addServer($server_endpoint, $server_port); /* Configure the client to use TLS */ if(!$tls_client->setOption(Memcached::OPT_USE_TLS, 1)) { echo $tls_client->getLastErrorMessage(), "\n"; exit(1); } /* Set your TLS context configurations values. * See MemcachedTLSContextConfig in memcached-api.php for all configurations */ $tls_config = new MemcachedTLSContextConfig(); $tls_config->hostname = '*.mycluster.fnjyzo.use1.cache.amazonaws.com'; $tls_config->skip_cert_verify = false; $tls_config->skip_hostname_verify = false; /* Use the created TLS context configuration object to create OpenSSL's SSL_CTX and set it to your client. * Note: These TLS context configurations will be applied to all the servers connected to this client. */ $tls_client->createAndSetTLSContext((array)$tls_config); /* test the TLS connection with set-get scenario: */ /* store the data for 60 seconds in the cluster. * The client will decide which cache host will store this item. */ if($tls_client->set('key', 'value', 60)) { print "Successfully stored key\n"; } else { echo "Failed to set key: ", $tls_client->getLastErrorMessage(), "\n"; exit(1); } /* retrieve the key */ if ($tls_client->get('key') === 'value') { print "Successfully retrieved key\n"; } else { echo "Failed to get key: ", $tls_client->getLastErrorMessage(), "\n"; exit(1); }

PHP 클라이언트 사용 방법에 관한 자세한 정보는 PHP용 ElastiCache 클러스터 클라이언트 설치 섹션을 참조하세요.