skip to Main Content

I have created a snapshot based on the running instance. This instance is perfectly fine, I just want to create a separate instance where I can play around or experiment. Now, after I created the snapshot, I created the AMI based on the snapshot. Now my question is, when I launch the AMI as an instance using the Launch instance from AMI button, will it affect my original instance, the one that is currently running? I just need to make sure that I will not affect in any way, the original instance, to avoid damages or anything that might affect the operation of the original instance.
enter image description here

3

Answers


  1. Launching the AMI won’t affect the original ec2.
    AMI’s are pretty expensive. You would likely be better off spinning up a basic ec2 and installing what you need in userdata.
    https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html

    Here is a snippet from a CloudFormation template that will spin up an ec2 and run some commands.

    cfn-init would be something to check out if you really want to get into it with deploying ec2.

      jumpHostEC2:
        Type: 'AWS::EC2::Instance'
        Properties:
          BlockDeviceMappings: # the secondary drive is listed in volumes to tag it so it will get backed up.
            - DeviceName: /dev/sda1
              Ebs:
                VolumeSize: 20
                VolumeType: gp2
          #IamInstanceProfile: <some profile>
          ImageId: ami-00xxxxxxxxxxxxxxx
          InstanceType: t2.micro
          KeyName: dev-instances
          SecurityGroupIds: # the two sg groups are for ssh and Qualys
            - sg-xxxxxxxxx
            - sg-xxxxxxxxx
          SubnetId: subnet-xxxxxxxxx
          Tags: # this controls apt-get patching
            - Key: Name
              Value: jumphost
          UserData: 
            Fn::Base64:
              #!/bin/bash
              set -e
              apt-get update
              DEBIAN_FRONTEND=noninteractive apt-get install -qq --no-install-recommends python-pip libssl-dev libffi-dev 
              wget dpkg-dev debhelper build-essential
              rm -rf /var/lib/apt/lists/*
              apt-get update -y
              apt-get install -y python-pip
    
    Login or Signup to reply.
  2. will it affect my original instance, the one that is currently running?

    No.

    I just need to make sure that I will not affect in any way, the original instance, to avoid damages or anything that might affect the operation of the original instance.

    Indeed, you have to ensure, to have separate accounting for the separate instances, as otherwise, credits go out faster because you use more resources und then credits are being spend faster and this will affect all running instances. Separate that part first.

    Apart from that, in general no. However, keep in mind, that there are no backups or guarantees and you’re operating in a running, complex system. The next instance you launch might just be that instance that brings complete AWS down due to some unforeseen configuration bug. Very unlikely, but as the systems are interconnected through and dependent on AWS, you might hit the Jackpot and bring a large share of the US Internet Market down just by chance.

    Login or Signup to reply.
  3. Will it affect my original instance, the one that is currently running?

    No.

    An Amazon EBS Snapshot is a copy of an Amazon EBS Volume. Think of it like a backup copy of the disk.

    When you create an AMI from a Snapshot, the AMI just points to the Snapshot. Then, when you launch an instance using the AMI, it associates the Snapshot with the new EBS boot disk on the instance. When the EC2 instance goes to access some data on that boot volume, it will retrieve the block from the EBS snapshot.

    Any changes made to the boot volume will be stored on the EBS Volume without impacting the Snapshot or the AMI.

    The original instance is not involved in any of this — the contents of its disk is not impacted by creating the Snapshot or using the Snapshot as an AMI.

    By the way, taking a Snapshot of a ‘running instance’ means that not all data might have been written to disk. When the Snapshot is used to create an AMI and the instance is booted from that AMI, the disk will be a reflection of the original instance at the moment the original Snapshot was taken. This is similar to pulling the power cord out of a PC — the next time it boots it might might take a little longer since it was not shutdown correctly. To avoid this situation, when an AMI is created from a running instance there is a default option to reboot the instance — the underlying snapshot is then created after the instance was shutdown and before it was booted again. This makes a more reliable disk image.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search