diff --git a/moto/ec2/responses/instances.py b/moto/ec2/responses/instances.py index 479cc3edb..78b1ccfc9 100644 --- a/moto/ec2/responses/instances.py +++ b/moto/ec2/responses/instances.py @@ -463,7 +463,7 @@ INSTANCE_TEMPLATE = """ {{ instance.private_dns }} {{ instance.public_dns }} {{ instance.public_dns }} - + {{ instance._reason }} {% if instance.key_name is not none %} {{ instance.key_name }} {% endif %} diff --git a/tests/test_ec2/test_instances.py b/tests/test_ec2/test_instances.py index 161938d7b..7cd80dcbb 100644 --- a/tests/test_ec2/test_instances.py +++ b/tests/test_ec2/test_instances.py @@ -973,6 +973,7 @@ def test_instance_start_and_stop(): instance1.reload() assert instance1.state == {"Code": 80, "Name": "stopped"} + assert instance1.state_transition_reason.startswith("User initiated") with pytest.raises(ClientError) as ex: client.start_instances(InstanceIds=[instance1.id], DryRun=True)