RDS Aurora Cluster 자동 기동 정지 간이판(Lambda 미사용판)
개요
사전 준비
상세
파이썬 업데이트
$ python --version
$ pyenv install --list
$ pyenv install 3.6.4
$ pyenv global 3.6.4
$ python --version
Python 3.6.4
오래된 Cli가 있으면 삭제
$ sudo yum list installed | grep awscli
$ pip3 list
Package Version
--------------- --------
awscli 1.16.264
boto3 1.10.0
botocore 1.13.0
colorama 0.4.1
docutils 0.15.2
jmespath 0.9.4
pip 9.0.1
pyasn1 0.4.7
python-dateutil 2.8.0
PyYAML 5.1.2
rsa 3.4.2
s3transfer 0.2.1
setuptools 28.8.0
six 1.12.0
urllib3 1.25.6
$ pip uninstall awscli ※必要に応じて
$ pip3 uninstall awscli
:
Successfully uninstalled awscli-1.16.264
awscli 설치
$ sudo pip3 install awscli --upgrade
:
Successfully installed awscli-1.16.266 botocore-1.13.2
$ aws --version
aws-cli/1.16.264 Python/3.7.4 Linux/4.9.85-47.59.amzn2.x86_64 botocore/1.13.0
$ pip3 list
Package Version
--------------- --------
awscli 1.16.266
boto3 1.10.0
botocore 1.13.2
colorama 0.4.1
docutils 0.15.2
jmespath 0.9.4
pip 9.0.1
pyasn1 0.4.7
python-dateutil 2.8.0
PyYAML 5.1.2
rsa 3.4.2
s3transfer 0.2.1
setuptools 28.8.0
six 1.12.0
urllib3 1.25.6
권한 설정
정책 설정
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:GetLogEvents"
],
"Resource": [
"*"
]
},
{
"Effect": "Allow",
"Action": [
"rds:DescribeDBClusters",
"rds:ListTagsForResource",
"rds:StartDBCluster",
"rds:StopDBCluster"
],
"Resource": [
"*"
]
}
]
}
그룹
사용자
액세스 키
동작 확인
$ aws rds stop-db-cluster help
$ aws rds stop-db-cluster --db-cluster-identifier <cluster_name>
$ aws rds start-db-cluster --db-cluster-identifier <cluster_name>
cron 설정
$ sudo vi /etc/cron.d/startRdsAuroraCluster
30 9 * * 1-5 appuser /usr/local/bin/aws rds start-db-cluster --db-cluster-identifier <cluster_name>
$ sudo vi /etc/cron.d/stopRdsAuroraCluster
0 23 * * 1-5 appuser /usr/local/bin/aws rds stop-db-cluster --db-cluster-identifier <cluster_name>
발생한 오류 1
$ aws rds start-db-cluster --db-cluster-identifier <cluster_name>
An error occurred (AccessDenied) when calling the StartDBCluster operation: User: arn:aws:iam::**********:user/stopstart_user is not authorized to perform: rds:StartDBCluster on resource: arn:aws:rds:ap-northeast-1:**********:cluster:<cluster_name>
발생한 오류 2
$ aws rds start-db-cluster --db-cluster-identifier <cluster_name>
You must specify a region. You can also configure your region by running "aws configure".
$ aws configure
AWS Access Key ID [None]: *******************
AWS Secret Access Key [None]:*******************
Default region name [None]: ap-northeast-1
Default output format [None]: json
$ aws configure list
Name Value Type Location
---- ----- ---- --------
profile <not set> None None
access_key ****************YUOM shared-credentials-file
secret_key ****************zrkd shared-credentials-file
region ap-northeast-1 config-file ~/.aws/config
Reference
이 문제에 관하여(RDS Aurora Cluster 자동 기동 정지 간이판(Lambda 미사용판)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/ezaqiita/items/97398494cba914b35675텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)