title: Resizing root volume size of ec2 instance with cloudformation
body: <p>I have an instance created with cloudformation like below:</p>
  <pre><code>EC2Instance:
      Type: AWS::EC2::Instance
      Properties:
        ImageId: !Ref ServerAMI
        InstanceType: !Ref ServerInstanceType
        KeyName: !Ref KeyName
        BlockDeviceMappings:
        - DeviceName: /dev/xvda
          Ebs:
            VolumeSize: 30
        NetworkInterfaces:
        - AssociatePublicIpAddress: 'false'
          DeleteOnTermination: 'true'
          DeviceIndex: '0'
          GroupSet:
          - Ref: ServerSecurityGroup
          SubnetId: !Ref SubnetID
        Tags:
        - { Key: Name, Value: !Ref AWS::StackName }
  </code></pre>
  <p>My root volume in this case is created at 30GB. If I try increase this root volume size by setting the <code>VolumeSize</code> value then my ec2 instance is terminated and recreated.</p>
  <p>Yet in the console I am able to increase the size of my root volume without recreation of my instance.</p>
  <p>Is there any work around for this in order to prevent ec2 instance from being terminated when trying to increase root volume size via cloudformation?</p>
  <p>Edit:
  Here is a small test stack I'm using to test this again. Deployed once, then change VolumeSize and redeploy - it wants to replace the instance:</p>
  <pre><code>AWSTemplateFormatVersion: '2010-09-09'
  
  Description: Test stack for a single ec2 instance
  
  Parameters:
  
    ServerAMI:
      Type: String
      Default: ami-096f43ef67d75e998
  
    ServerInstanceType:
      Type: String
      Default: t2.small
  
    DefaultVPCID:
      Type: String
  
    SubnetID:
      Type: String
  
    KeyName:
      Type: AWS::EC2::KeyPair::KeyName
  
  Resources:
    EC2Instance:
      Type: AWS::EC2::Instance
      Properties:
        ImageId: !Ref ServerAMI
        InstanceType: !Ref ServerInstanceType
        KeyName: !Ref KeyName
        BlockDeviceMappings:
        - DeviceName: /dev/xvda #Linux
          Ebs:
            VolumeSize: 30
        NetworkInterfaces:
        - AssociatePublicIpAddress: 'false'
          DeleteOnTermination: 'true'
          DeviceIndex: '0'
          GroupSet:
          - Ref: ServerSecurityGroup
          SubnetId: !Ref SubnetID
        Tags:
        - { Key: Name, Value: !Ref AWS::StackName }
  
    ServerSecurityGroup:
      Type: AWS::EC2::SecurityGroup
      Properties:
        GroupDescription: Webserver security group
        VpcId: !Ref DefaultVPCID
        SecurityGroupIngress:
        - { IpProtocol: tcp, FromPort: '22',   ToPort: '22',   CidrIp: '127.0.0.1/32',   Description: 'Test Instance'  }
  </code></pre>