JSCODE Logo
프로그래밍 과외블로그후기멘토진
회사명 : JSCODE대표 : 박재성사업자 등록번호 : 244-22-01557통신판매업 : 제 2023-인천미추홀-0381 호
학원 명칭 : 제이에스코드(JSCODE)원격학원학원설립ㆍ운영 등록번호 : 제6063호

서울특별시 구로구 경인로 20가길 11(오류동, 아델리아)

Copyright ⓒ 2025 JSCODE - 최상위 현업 개발자들의 프로그래밍 교육 All rights reserved.

이용약관개인정보처리방침
← 블로그 목록으로 돌아가기

Spring Boot에 ElastiCache 연결하기

JSCODE 박재성
JSCODE 박재성
2025-12-06
author
JSCODE 박재성
category
Redis
createdAt
Dec 6, 2025
series
비전공자도 이해할 수 있는 Redis 입문/실전
slug
connect-elasticache-to-spring-boot
type
post
updatedAt
Dec 6, 2025 04:33 AM

✅ Spring Boot에 ElastiCache 연결하기

  1. application.yml 파일 수정하기
    1. application.yml
      # local 환경 spring: profiles: default: local datasource: url: jdbc:mysql://host.docker.internal:3306/mydb username: root password: password driver-class-name: com.mysql.cj.jdbc.Driver jpa: hibernate: ddl-auto: update show-sql: true data: redis: host: cache-server port: 6379 logging: level: org.springframework.cache: trace --- # prod 환경 spring: config: activate: on-profile: prod datasource: url: jdbc:mysql://instagram-db.coseefawhrzc.ap-northeast-2.rds.amazonaws.com:3306/mydb username: admin password: password data: redis: host: instagram-cache-server.s8nyjv.ng.0001.apn2.cache.amazonaws.com port: 6379
 
  1. Github Repository에 Push하기
    1.  
  1. EC2에서 Git Pull 받기
    1. $ cd {프로젝트 경로 } $ git pull origin main
 
  1. 기존 서버 종료시키기
    1. $ docker compose down # 이전 실습에서 실행시켰던 컨테이너 종료시키기 $ docker ps # 종료됐는 지 확인
 
  1. Spring Boot 프로젝트 실행시키기
    1. $ ./gradlew clean build -x test $ cd build/libs $ java -jar -Dspring.profiles.active=prod {빌드된 jar 파일명}
 
  1. Postman으로 테스트해보기
    1. notion image
 
  1. 실제 ElastiCache에 캐시가 저장되고 있는 지 확인해보기
    1. 새로운 EC2 창 열어서 아래 명령어를 통해 ElastiCache에 접속하기
      $ redis-cli -h {ElastiCache의 기본 엔드포인트} $ keys * $ get getBoards::boards:page:1:size:10 $ ttl getBoards::boards:page:1:size:10
 
 

✅ 전체 흐름 다시 복습하기

📖
EC2, RDS, Spring Boot, ElastiCache를 활용한 아키텍처 구성
author
category
Redis
createdAt
series
비전공자도 이해할 수 있는 Redis 입문/실전
slug
type
series-footer
updatedAt
Dec 6, 2025 04:33 AM
📎
이 글은 비전공자도 이해할 수 있는 Redis 입문/실전 (조회 성능 최적화편) 강의의 수업 자료 중 일부입니다.