2017-11-13 4 views
0

기존 데이터베이스의 설정으로 빈 데이터베이스의 데이터베이스 생성 문자열을 자동 생성하는 방법이 있습니까?aws cli 명령을 사용하여 기존 데이터베이스에서 RDS 인스턴스 생성

브라우저에서 콘솔을 사용하여 AWS RDS postgresql 데이터베이스 인스턴스를 만들었습니다. 브라우저에서 모든 설정을 선택하고 인스턴스를 시작했습니다. 이제이 데이터베이스 (비어 있음)를 프로그래밍 방식으로 사용하기위한 명령으로 복제하려고합니다.

aws create-db-instance --db-name database02 --allocated-storage 200 --engine postgres etc. 

답변

1

당신은 소스 데이터베이스, 인스턴스 또는 클러스터의 스냅 샷을 생성해야합니다 : 내가 좋아하는 기존의 RDS의 너무 원시 명령이 선호 될 경우 (다른 RDS에 대한 참조)하지만, 뭔가를 삭제하려면 해당 스냅 샷을 기반으로 새 데이터베이스를 만듭니다. 스냅 샷이 완료되면 원본 데이터베이스를 삭제할 수 있습니다.

aws rds create-db-snapshot 
    --db-snapshot-identifier mydbsnapshot 
    --db-instance-identifier mydb 

aws rds restore-db-instance-from-db-snapshot 
    --db-instance-identifier mynewdbinstance 
    --db-snapshot-identifier mydbsnapshot 

http://docs.aws.amazon.com/cli/latest/reference/rds/create-db-snapshot.html

http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_RestoreFromSnapshot.html

http://docs.aws.amazon.com/cli/latest/reference/rds/restore-db-instance-from-db-snapshot.html