SpringBoot x EC2 x RDS
1.
2.
SpringBoot μν νλ‘μ νΈ μμ±
3.
λ°μ΄ν° μμ€ μ€μ
a.
RDS μλν¬μΈνΈλ‘ μ€μ
4.
νλ‘μ νΈ λ‘컬 ν
μ€νΈ
5.
νλ‘μ νΈ λ°°ν¬
6.
μλ² ν
μ€νΈ
μ¬μ μμ
EC2 X RDS μ°λ μμ
λ¨Όμ νκ³ μ€μΈμ!
SpringBoot μν νλ‘μ νΈ μμ±
λ°μ΄ν° μμ€ μ€μ
β’
λ°μ΄ν°λ² μ΄μ€ : MySQL
β’
URL : RDS μλν¬μΈνΈ (aloha-aws-db.xxxxxxxx.com:3306)
β’
username : admin
β’
password : xxxxxx
RDS μλν¬μΈνΈλ‘ μ€μ
# π» server
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://aloha-aws-db.xxxxxxxx.com:3306/aloha?serverTimezone=Asia/Seoul&allowPublicKeyRetrieval=true&useSSL=false&autoReconnection=true&autoReconnection=true
spring.datasource.username=admin
spring.datasource.password=xxxxxx
Java
볡μ¬
application.properties
spring.application.name=check
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
# π©βπ» local
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/aloha?serverTimezone=Asia/Seoul&allowPublicKeyRetrieval=true&useSSL=false&autoReconnection=true&autoReconnection=true
spring.datasource.username=aloha
spring.datasource.password=123456
# π» server
# spring.datasource.url=jdbc:mysql://aloha-qr-db.ctm4c4acm90g.ap-northeast-2.rds.amazonaws.com:3306/aloha?serverTimezone=Asia/Seoul&allowPublicKeyRetrieval=true&useSSL=false&autoReconnection=true&autoReconnection=true
# spring.datasource.username=admin
# spring.datasource.password=xxxxxx
mybatis.configuration.map-underscore-to-camel-case=true
mybatis.type-aliases-package=com.aloha.check.dto
mybatis.mapper-locations=classpath:mybatis/mapper/**/**.xml
Java
볡μ¬
RDS μλν¬μΈνΈ
νλ‘μ νΈ λ‘컬 ν μ€νΈ
http://localhost:8080/checks
HTML
볡μ¬
νλ‘μ νΈ λ°°ν¬
μλ² ν μ€νΈ
http://ec2-XXX-XXX-XXX-XXX.ap-northeast-2.compute.amazonaws.com:8080/checks
HTML
볡μ¬