By default, any additional EBS volumes that you attach to an EC2 instance persist even after the instance terminates, unless Delete On Termination is set on each of the attached volumes. This AWS doc shows how to set it in the console and cli but not in PowerShell.
However, the cli example uses "aws ec2 modify-instance-attribute" and you can find in the AWS PowerShell reference doc a cmdlet with similar name Edit-EC2InstanceAttribute. So here is how to set it with PowerShell.
First, you need to instantiate two classes InstanceBlockDeviceMappingSpecification and EbsInstanceBlockDeviceSpecification
$bdm = New-Object Amazon.EC2.Model.InstanceBlockDeviceMappingSpecification $ebs = New-Object Amazon.EC2.Model.EbsInstanceBlockDeviceSpecification
[ { "DeviceName": "device_name", "Ebs": { "DeleteOnTermination": true } } ]
$ebs.DeleteOnTermination = $true $bdm.DeviceName = 'device_name' $bdm.Ebs = $ebs
Edit-EC2InstanceAttribute -InstanceId 'id' -BlockDeviceMapping $bdm -Region 'region'