diff --git a/tests/system/providers/amazon/aws/example_ec2.py b/tests/system/providers/amazon/aws/example_ec2.py index aeffe4ad34ff7..11320f1047cc9 100644 --- a/tests/system/providers/amazon/aws/example_ec2.py +++ b/tests/system/providers/amazon/aws/example_ec2.py @@ -50,11 +50,20 @@ def get_latest_ami_id(): # on how they name the new images. This page should have AL2022 info when # it comes available: https://aws.amazon.com/linux/amazon-linux-2022/faqs/ image_prefix = "Amazon Linux*" + root_device_name = "/dev/xvda" images = boto3.client("ec2").describe_images( Filters=[ {"Name": "description", "Values": [image_prefix]}, - {"Name": "architecture", "Values": ["arm64"]}, + { + "Name": "architecture", + "Values": ["x86_64"], + }, # t3 instances are only compatible with x86 architecture + { + "Name": "root-device-type", + "Values": ["ebs"], + }, # instances which are capable of hibernation need to use an EBS-backed AMI + {"Name": "root-device-name", "Values": [root_device_name]}, ], Owners=["amazon"], ) @@ -97,7 +106,7 @@ def parse_response(instance_ids: list): image_id = get_latest_ami_id() config = { - "InstanceType": "t4g.micro", + "InstanceType": "t3.micro", "KeyName": key_name, "TagSpecifications": [ {"ResourceType": "instance", "Tags": [{"Key": "Name", "Value": instance_name}]} @@ -106,6 +115,9 @@ def parse_response(instance_ids: list): # https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html "MetadataOptions": {"HttpEndpoint": "enabled", "HttpTokens": "required"}, "HibernationOptions": {"Configured": True}, + "BlockDeviceMappings": [ + {"DeviceName": "/dev/xvda", "Ebs": {"Encrypted": True, "DeleteOnTermination": True}} + ], } # EC2CreateInstanceOperator creates and starts the EC2 instances. To test the EC2StartInstanceOperator, @@ -151,6 +163,7 @@ def parse_response(instance_ids: list): instance_ids=instance_id, ) # [END howto_operator_ec2_reboot_instance] + reboot_instance.wait_for_completion = True # [START howto_operator_ec2_hibernate_instance] hibernate_instance = EC2HibernateInstanceOperator( @@ -158,6 +171,8 @@ def parse_response(instance_ids: list): instance_ids=instance_id, ) # [END howto_operator_ec2_hibernate_instance] + hibernate_instance.wait_for_completion = True + hibernate_instance.max_attempts = 75 # [START howto_operator_ec2_terminate_instance] terminate_instance = EC2TerminateInstanceOperator(