개발환경 구성
패키지 설치 및 설정
# nodejs(v12.x) 설치
$ sudo curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
$ sudo yum clean all && sudo yum makecache fast
$ sudo yum -y install gcc-c++ make
$ sudo yum -y install nodejs
# nodejs 버전확인
$ node -v
# python(v3.8) 및 컴파일러 다운로드/압축해제
$ sudo yum -y install gcc openssl-devel bzip2-devel libffi-devel
$ cd /opt
$ sudo wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
$ sudo tar -xvf Python-3.6.0.tgz
$ cd Python-3.6.0
# python(v3.8) 설치
$ sudo ./configure --enable-optimizations
$ sudo make altinstall
# python 버전 변경
$ sudo update-alternatives --config python
None
$ sudo update-alternatives --install /usr/bin/python python /opt/Python-3.8.0/python 1
$ sudo update-alternatives --config python
There are 2 programs which provide 'python'.
Selection Command
-----------------------------------------------
* 1 /opt/Python-3.8.0/python
Enter to keep the current selection[+], or type selection number: 1
# python 버전확인
$ python --version
Python3.8.0
# 참고) 파이썬 alternatives 목록삭제 방법
$ sudo update-alternatives --remove python /opt/Python-3.8.0
config 설정 및 프로젝트 생성
# aws config
$ aws configure
aws_access_key_id [None] : access key
aws_secret_access_key [None] : secret key
Default region name [None] : ap-northeast-1
Default output format [None] : text
# aws-cdk 설치
### aws-cdk는 npm 기반으로 npm, nodejs 패키지를 설치해야만 설치할 수 있음
$ sudo npm install -g aws-cdk
/usr/bin/cdk -> /usr/lib/node_modules/aws-cdk/bin/cdk
+ aws-cdk@1.74.0
added 188 packages from 186 contributors in 9.353s
# 프로젝트 폴더 생성 및 python 언어로 초기화
$ sudo mkdir cdk-work
$ cd cdk-work
$ cdk init app --language=python
# Welcome ... 중략
Enjoy!
Initializing a new git repository...
/bin/sh: git: command not found
Unable to initialize git repository for your project.
Please run 'python3 -m venv .venv'!
Executing Creating virtualenv...
/bin/sh: python3: command not found
Unable to create virtualenv automatically
Please run 'python3 -m venv .venv'!
✅ All done!
# aws-cdk 표준 종속성 설치
$ cd cdk-work
$ sudo python -m pip install -r requirements.txt
# aws-cdk 표준 종속성 업데이트 허용 설정(root로 로그인)
$ cd cdk-work
$ python -m pip install -r requirements.txt
AWS CDK On Python 설치 참고 가이드