![[AWS Technical Support Note] วิธีการระบุ CA Certificate ของ Instance ที่ Restore มาจาก RDS Snapshot](https://devio2024-media.developers.io/image/upload/v1745220008/user-gen-eyecatch/n1ki2mw28hlngyn0witi.webp)
[AWS Technical Support Note] วิธีการระบุ CA Certificate ของ Instance ที่ Restore มาจาก RDS Snapshot
ปัญหาที่เกิดขึ้น
สร้าง Snapshot ของ Aurora Cluster ที่ใช้งาน Amazon RDS CA : rds-ca-2019
ตอนที่ restore ตัว RDS, snapshot บน AWS Management console Parameter CA กลายเป็น rds-ca-rsa2048-g1 แทนที่จะเป็นตัวที่ถูกใช้งานอยู่
วิธีแก้ปัญหา
สาเหตุ
หากเรา restore ตัว snapshot โดยใช้ AWS Management Console จะไม่สามารถระบุ CA ที่ต้องการใช้งานได้ และ CA ที่เป็น default จะถูกนำมาใช้งานเมื่อทำการ restore (ในบล็อกนี้คือ rds-ca-rsa2048-g1)
วิธีแก้ปัญหา
ถ้าเราอยาก restore ตัว Aurora Instance พร้อมด้วย CA ที่กำลังใช้งานอยู่ (rds-ca-2019) หลังจาก restore ตัว Cluster ด้วย AWS CLI(restore-db-cluster-from-snapshot) แล้ว ให้ระบุ rds-ca-2019 ที่ option ของ --ca-certificate-identifier ในคำสั่ง create-db-instance
ลองทำดู
Restore Aurora Cluster
อันดับแรก restore ตัว Aurora Cluster ด้วยคำสั่ง restore-db-cluster-from-snapshot
$ aws rds restore-db-cluster-from-snapshot
--db-cluster-identifier test-aurora-cluster-restore-from-cli
--snapshot-identifier test-aurora-cluster-shapshot
--engine aurora-postgresql
จากรูปล่างจะเห็นว่าเราทำการ Restore ตัว Aurora Cluster สำเร็จแล้ว
Restore Aurora Instance
ต่อมาเราจะ restore ตัว Instance ของ Aurora โดยระบุ rds-ca-2019 ด้วย option --ca-certificate-identifier ในคำสั่ง create-db-instance
$ aws rds create-db-instance \
--db-cluster-identifier test-aurora-cluster-restore-from-cli \
--db-instance-identifier test-aurora-instance-restore-from-cli \
--db-instance-class db.t3.medium \
--engine aurora-postgresql \
--ca-certificate-identifier rds-ca-2019
Restore ตัว Instance ที่ใช้งาน rds-ca-2019 สำเร็จแล้ว
ในกรณีที่ต้องการระบุ rds-ca-2019 เป็น CA ตอนที่ restore ตัว Instance
ในกรณีนี้เราต้องระบุ rds-ca-2019 ที่ option --ca-certificate-identifier ของคำสั่ง restore-db-instance-from-db-snapshot
$ aws rds restore-db-instance-from-db-snapshot \
--db-instance-identifier test-mysql-instance-restore-from-cli \
--db-snapshot-identifier test-instance-snapshot \
--db-instance-class db.t3.medium \
--ca-certificate-identifier rds-ca-2019
Restore ตัว Instance พร้อมด้วย rds-ca-2019 ได้แล้ว
บทความอ้างอิง
- Tutorial: Restore an Amazon Aurora DB cluster from a DB cluster snapshot (English)
- Rotating your SSL/TLS certificate (English)
- restore-db-cluster-from-snapshot (English)
- create-db-instance (English)
- restore-db-instance-from-db-snapshot (English)
บทความอื่นๆที่เกี่ยวข้องกับ Amazon RDS
- วิธีการสร้างและ Restore Snapshot ใน RDS หรือ Aurora (Thai)
- วิธีทำให้ endpoint เป็นตัวเดียวกับ instance ดั้งเดิม เมื่อกู้คืน RDS instance ด้วย snapshot (Thai)
บทความต้นฉบับ
RDS スナップショットからのインスタンスの復元時に CA 証明書を指定する方法 (Japanese)