{"action":"closed","issue":{"url":"https://api.github.com/repos/spulec/moto/issues/1258","repository_url":"https://api.github.com/repos/spulec/moto","labels_url":"https://api.github.com/repos/spulec/moto/issues/1258/labels{/name}","comments_url":"https://api.github.com/repos/spulec/moto/issues/1258/comments","events_url":"https://api.github.com/repos/spulec/moto/issues/1258/events","html_url":"https://github.com/spulec/moto/issues/1258","id":264804222,"number":1258,"title":"Instance.modify_attribute() not working for blockDeviceMapping","user":{"login":"domingosnovo","id":7971296,"avatar_url":"https://avatars0.githubusercontent.com/u/7971296?v=4","gravatar_id":"","url":"https://api.github.com/users/domingosnovo","html_url":"https://github.com/domingosnovo","followers_url":"https://api.github.com/users/domingosnovo/followers","following_url":"https://api.github.com/users/domingosnovo/following{/other_user}","gists_url":"https://api.github.com/users/domingosnovo/gists{/gist_id}","starred_url":"https://api.github.com/users/domingosnovo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domingosnovo/subscriptions","organizations_url":"https://api.github.com/users/domingosnovo/orgs","repos_url":"https://api.github.com/users/domingosnovo/repos","events_url":"https://api.github.com/users/domingosnovo/events{/privacy}","received_events_url":"https://api.github.com/users/domingosnovo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-10-12T03:38:19Z","updated_at":"2017-10-18T23:23:38Z","closed_at":"2017-10-18T23:23:38Z","author_association":"NONE","body":"## Reporting Bugs\r\n\r\nI am trying to set the `DeleteOnTermination` attribute of a volume attached to an instance to `True` using the boto3 method `EC2.Instance.modify_attribute()`, but it doesn't seem to be doing the trick.\r\n\r\nI tried using the procedure described in [this link](https://github.com/spulec/moto/blob/a7049acf70afb2261c6a92c193ada51458e91cd5/moto/ec2/responses/instances.py#L147). I also tried using `EC2.Client.modify_instance_attribute()`, and neither option worked. No errors at all, just that the attribute itself wasn't updated.\r\n\r\nI've wrote the following python snippet to reproduce this issue:\r\n\r\n```python\r\nfrom moto import mock_ec2\r\nimport boto3\r\nfrom pprint import pprint\r\n\r\n\r\n@mock_ec2\r\ndef main():\r\n    ec2_client = boto3.resource('ec2', region_name='us-west-1')\r\n    result = ec2_client.create_instances(ImageId='ami-12345678', MinCount=1, MaxCount=1)\r\n    instance = result[0]\r\n    instance.load()\r\n    pprint(instance.block_device_mappings)\r\n    instance.modify_attribute('blockDeviceMapping', {'/dev/sda1': True})\r\n    instance.load()\r\n    pprint(instance.block_device_mappings)\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    main()\r\n```\r\n\r\nWhich when executed, should set the `DeleteOnTermination` attribute of the attached EBS volume to `True`. But this is not the case, as per this bash output:\r\n\r\n```bash\r\nroot@ip-10-132-17-214:~# ./a.py\r\n[{'DeviceName': '/dev/sda1',\r\n  'Ebs': {'AttachTime': datetime.datetime(2017, 10, 12, 3, 24, 23, tzinfo=tzlocal()),\r\n          'DeleteOnTermination': False,\r\n          'Status': 'in-use',\r\n          'VolumeId': 'vol-8d707b2a'}}]\r\n[{'DeviceName': '/dev/sda1',\r\n  'Ebs': {'AttachTime': datetime.datetime(2017, 10, 12, 3, 24, 23, tzinfo=tzlocal()),\r\n          'DeleteOnTermination': False,\r\n          'Status': 'in-use',\r\n          'VolumeId': 'vol-8d707b2a'}}]\r\nroot@ip-10-132-17-214:~#\r\n```\r\n\r\nI'm using Moto 1.1.22 and Boto3 1.4.7, which I installed using `pip install <packagename>` on a freshly launched Ubuntu 16.04.03 instance running on AWS."}}
{"actor":{"display_login":"JackDanger"}}