Without stopping the EC2 Instance How to Replace EC2 Root Volume

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 พ.ย. 2024

ความคิดเห็น • 2

  • @benbeseda7976
    @benbeseda7976 7 หลายเดือนก่อน +1

    Is there anyway how to do this thing automatically? for example I would like to replace root volume of my EC2 instance every day for a new one

    • @CloudAWS
      @CloudAWS  7 หลายเดือนก่อน

      Hi,
      Welcome to the CloudTech family. Yes, we can do it by boto3 SDK.
      Solution-1 AWS Lambda function that's triggered by a CloudWatch Events -> boto3 SDK(create_snapshot,create_volume,replace root volume) - > minimal downtime need
      Solution- 2
      AWS Lambda function that's triggered by a CloudWatch Events rule to run every day for (Create an AMI of your instance - > create_image(boto3 method)
      Launch a new instance from the AMI (run_instances)
      Switch traffic to the new instance (if ur are using LB then you can switch traffic to a new instance or for Route53 update DNS)
      Terminate the old instance - (terminate_instances)
      hope it will give you clarity. let me know if you need any sessions for this.