aldy120 / self-hosting-wordpress-blog

0 stars 0 forks source link

節省 EBS 費用 #15

Open aldy120 opened 1 year ago

aldy120 commented 1 year ago

目前的 EBS 太貴了,似乎 over estimate 。理論上可以建立一個比較小的 EBS Volume 並且把東西複製一份過去,再把原本的 EBS Volume 換掉。

You can’t use snapshots to launch a new instance, but you can use them to replace volumes on an existing instance. If you experience data corruption or a volume failure, you can create a volume from a snapshot that you have taken and replace the old volume. You can also use snapshots to provision new volumes and attach them during a new instance launch.

另一個方式是使用 EFS/FSx 換掉 EBS 。感覺省錢又隨時可方便的擴容。

aldy120 commented 1 year ago

https://aws.amazon.com/premiumsupport/knowledge-center/ebs-increase-decrease-volume-size/#:~:text=You%20can%20only%20increase%20the,using%20an%20application%2Dlevel%20tool.

aldy120 commented 1 year ago

AMI

aldy120 commented 1 year ago

先還原備份,應該會帶一個 80 G 的 EBS 新的 EC2 出來。 接下來在新的 EC2 新增一個 EBS ,80 G 的 EBS 複製進去,再把 80 G 的移除。mapping mount 那邊要接好。

aldy120 commented 1 year ago

要 restore EC2 結果遇到下列錯誤。明明用的是 AWS backup 的 managed role。

You are not authorized to perform this operation. Please consult the permissions associated with your AWS Backup role(s), and refer to the AWS Backup documentation for more details. Encoded authorization failure message: IkPXr_9MrbqP38-OsJp3O6ZF2LXsIQY0eEizL7MIB02iyrcOrFwStrWkXkmcVwTaJ02Yxk2yy3n9b3EyvkZUhqye5hOFu-07i4OWJtEyBYmmSUnOfTz5SWWO6sJl27sVxkmU7QW5x8bUoFQhyuES1S-E15C213JtMIF5u29I8cwddAI4YXw46GGERkRM8LRg_VY6NZrG2sNU3RoYr3KTT-b7RvJQ-JccI1BJa7Ns-IEs_Z1I3R7_ix_I8_6ppdKbe1piWxVg1fGM_BXz27leKycdjKLjLD2MxvMyB2UidKk9Fk1pwejjCSST7iLh3rvOx0CGd_JKTARyBGMe3n8Bp_yuBiRQPi00exppUyUqjcvoLHnR0APsbN1r4g71VtBLQmZKyeXdg3f-pThtNqHFZ8cJN0FqQOiDIgcTyx51Uvv83U0MRtxBD-vAomKGNOGDGdeq2aPx8IDYN-8xoIejrWt9K3ksJh8aLLHiwOuYS1iBBKL0rPaISRFhm6IkAggJkPZ_mSuU9If3YzY5m8g098N4nziAiEE
Screen Shot 2023-04-02 at 00 45 43

查了一下發現通常是缺少 iam:PassRole 權限。

解法是是在 restore 的時候把不要指定 EC2 instance profile role https://repost.aws/knowledge-center/aws-backup-encoded-authorization-failure

aldy120 commented 1 year ago

Create and attach a volume to backup EC2.

Screen Shot 2023-04-02 at 01 57 32

Attach /dev/sdf 之後還有兩件事要做