diff --git a/tests/test_rds/test_rds.py b/tests/test_rds/test_rds.py index 522af30ddbff..1dcaff6bc497 100644 --- a/tests/test_rds/test_rds.py +++ b/tests/test_rds/test_rds.py @@ -2019,3 +2019,39 @@ def test_create_db_instance_with_tags(): resp = client.describe_db_instances(DBInstanceIdentifier=db_instance_identifier) resp["DBInstances"][0]["TagList"].should.equal(tags) + + +@mock_rds +def test_create_db_instance_without_availability_zone(): + region = "us-east-1" + client = boto3.client("rds", region_name=region) + db_instance_identifier = "test-db-instance" + resp = client.create_db_instance( + DBInstanceIdentifier=db_instance_identifier, + Engine="postgres", + DBName="staging-postgres", + DBInstanceClass="db.m1.small", + ) + resp["DBInstance"]["AvailabilityZone"].should.contain(region) + + resp = client.describe_db_instances(DBInstanceIdentifier=db_instance_identifier) + resp["DBInstances"][0]["AvailabilityZone"].should.contain(region) + + +@mock_rds +def test_create_db_instance_with_availability_zone(): + region = "us-east-1" + availability_zone = f"{region}c" + client = boto3.client("rds", region_name=region) + db_instance_identifier = "test-db-instance" + resp = client.create_db_instance( + DBInstanceIdentifier=db_instance_identifier, + Engine="postgres", + DBName="staging-postgres", + DBInstanceClass="db.m1.small", + AvailabilityZone=availability_zone, + ) + resp["DBInstance"]["AvailabilityZone"].should.equal(availability_zone) + + resp = client.describe_db_instances(DBInstanceIdentifier=db_instance_identifier) + resp["DBInstances"][0]["AvailabilityZone"].should.equal(availability_zone)