AWS/EC2

EC2에서 AWS RDS에 접속 하는 방법

Dev갱이 2023. 8. 13. 13:29
728x90

RDS에서 EC2 추가하는 것과 인바운드 아웃 바운드 설정을 마쳤다는 가정하에 기록한다.

[@ ~]# sudo su -

명령어로 관리자 권한을 얻는다.

[@ ~]# yum search postgresql
================================================================= Name & Summary Matched: postgresql =================================================================
collectd-postgresql.x86_64 : PostgreSQL plugin for collectd
postgresql15.x86_64 : PostgreSQL client programs
postgresql15-contrib.x86_64 : Extension modules distributed with PostgreSQL
postgresql15-docs.x86_64 : Extra documentation for PostgreSQL
postgresql15-llvmjit.x86_64 : Just-in-time compilation support for PostgreSQL
postgresql15-plperl.x86_64 : The Perl procedural language for PostgreSQL
postgresql15-plpython3.x86_64 : The Python3 procedural language for PostgreSQL
postgresql15-pltcl.x86_64 : The Tcl procedural language for PostgreSQL
postgresql15-private-devel.x86_64 : PostgreSQL development header files for this build of PostgreSQL server
postgresql15-private-libs.x86_64 : The shared libraries required only for this build of PostgreSQL server
postgresql15-server.x86_64 : The programs needed to create and run a PostgreSQL server
postgresql15-server-devel.x86_64 : PostgreSQL development header files and libraries
postgresql15-static.x86_64 : Statically linked PostgreSQL libraries
postgresql15-test.x86_64 : The test suite distributed with PostgreSQL
postgresql15-test-rpm-macros.noarch : Convenience RPM macros for build-time testing against PostgreSQL server
postgresql15-upgrade.x86_64 : Support for upgrading from the previous major release of PostgreSQL
====================================================================== Name Matched: postgresql ======================================================================
postgresql15-upgrade-devel.x86_64 : Support for build of extensions required for upgrade process
==================================================================== Summary Matched: postgresql =====================================================================
apr-util-pgsql.x86_64 : APR utility library PostgreSQL DBD driver
libpq.x86_64 : PostgreSQL client library
libpq-devel.x86_64 : Development files for building PostgreSQL client tools
perl-DBD-Pg.x86_64 : A PostgreSQL interface for Perl
perl-DateTime-Format-Pg.noarch : Parse and format PostgreSQL dates and times
php8.1-pgsql.x86_64 : A PostgreSQL database module for PHP 8.1
php8.2-pgsql.x86_64 : A PostgreSQL database module for PHP 8.2
postfix-pgsql.x86_64 : Postfix PostgreSQL map support
python-psycopg2-doc.x86_64 : Documentation for psycopg python PostgreSQL database adapter
python3-psycopg2.x86_64 : A PostgreSQL database adapter for Python 3
python3-psycopg2-debug.x86_64 : A PostgreSQL database adapter for Python 3 (debug build)
python3-psycopg2-tests.x86_64 : A testsuite for A PostgreSQL database adapter for Python 2

이렇게 설치 가능한 리스트가 나오는데 나의 AWS RDS버전은 15이기 떄문에

 

[@ ~]# yum install -y postgresql15.x86_64

 

psql --help

설치가 완료되면 help 명령어가 잘 작동한다

 

psql --host=endpoint --port=5432 --dbname=postgres --username=postgres

입력하고 나면 비밀번호 입력 하라고 나오는데 입력하면 접속 완료!

 

- [공식문서참고](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_GettingStarted.CreatingConnecting.PostgreSQL.html)

 

728x90