EC2 availability zones in us-west-1: use A and B (#5515)
This commit is contained in:
parent
37c5be725a
commit
9340335d73
@ -238,8 +238,8 @@ class RegionsAndZonesBackend:
|
|||||||
Zone(region_name="us-east-2", name="us-east-2c", zone_id="use2-az3"),
|
Zone(region_name="us-east-2", name="us-east-2c", zone_id="use2-az3"),
|
||||||
],
|
],
|
||||||
"us-west-1": [
|
"us-west-1": [
|
||||||
Zone(region_name="us-west-1", name="us-west-1b", zone_id="usw1-az3"),
|
Zone(region_name="us-west-1", name="us-west-1a", zone_id="usw1-az3"),
|
||||||
Zone(region_name="us-west-1", name="us-west-1c", zone_id="usw1-az1"),
|
Zone(region_name="us-west-1", name="us-west-1b", zone_id="usw1-az1"),
|
||||||
],
|
],
|
||||||
"us-west-2": [
|
"us-west-2": [
|
||||||
Zone(region_name="us-west-2", name="us-west-2a", zone_id="usw2-az2"),
|
Zone(region_name="us-west-2", name="us-west-2a", zone_id="usw2-az2"),
|
||||||
|
@ -96,7 +96,7 @@ class Instance(TaggedEC2Resource, BotoInstance, CloudFormationModel):
|
|||||||
self.user_data = user_data
|
self.user_data = user_data
|
||||||
self.security_groups = security_groups
|
self.security_groups = security_groups
|
||||||
self.instance_type = kwargs.get("instance_type", "m1.small")
|
self.instance_type = kwargs.get("instance_type", "m1.small")
|
||||||
self.region_name = kwargs.get("region_name", ec2_backend.region_name)
|
self.region_name = kwargs.get("region_name", "us-east-1")
|
||||||
placement = kwargs.get("placement", None)
|
placement = kwargs.get("placement", None)
|
||||||
self.subnet_id = kwargs.get("subnet_id")
|
self.subnet_id = kwargs.get("subnet_id")
|
||||||
if not self.subnet_id:
|
if not self.subnet_id:
|
||||||
@ -157,7 +157,7 @@ class Instance(TaggedEC2Resource, BotoInstance, CloudFormationModel):
|
|||||||
elif placement:
|
elif placement:
|
||||||
self._placement.zone = placement
|
self._placement.zone = placement
|
||||||
else:
|
else:
|
||||||
self._placement.zone = ec2_backend.zones[self.region_name][0].name
|
self._placement.zone = ec2_backend.region_name + "a"
|
||||||
|
|
||||||
self.block_device_mapping = BlockDeviceMapping()
|
self.block_device_mapping = BlockDeviceMapping()
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -56,6 +56,21 @@ def main():
|
|||||||
for i in instances:
|
for i in instances:
|
||||||
del i["LocationType"] # This can be reproduced, no need to persist it
|
del i["LocationType"] # This can be reproduced, no need to persist it
|
||||||
instances = sorted(instances, key=lambda i: (i['Location'], i["InstanceType"]))
|
instances = sorted(instances, key=lambda i: (i['Location'], i["InstanceType"]))
|
||||||
|
|
||||||
|
# Ensure we use the correct US-west availability zones
|
||||||
|
# There are only two - for some accounts they are called us-west-1b and us-west-1c
|
||||||
|
# As our EC2-module assumes us-west-1a and us-west-1b, we may have to rename the zones coming from AWS
|
||||||
|
# https://github.com/spulec/moto/issues/5494
|
||||||
|
if region == "us-west-1" and location_type == "availability-zone":
|
||||||
|
zones = set([i["Location"] for i in instances])
|
||||||
|
if zones == {"us-west-1b", "us-west-1c"}:
|
||||||
|
for i in instances:
|
||||||
|
if i["Location"] == "us-west-1b":
|
||||||
|
i["Location"] = "us-west-1a"
|
||||||
|
for i in instances:
|
||||||
|
if i["Location"] == "us-west-1c":
|
||||||
|
i["Location"] = "us-west-1b"
|
||||||
|
|
||||||
print("Writing data to {0}".format(dest))
|
print("Writing data to {0}".format(dest))
|
||||||
with open(dest, "w+") as open_file:
|
with open(dest, "w+") as open_file:
|
||||||
json.dump(instances, open_file, indent=1)
|
json.dump(instances, open_file, indent=1)
|
||||||
|
@ -148,7 +148,7 @@ def test_create_auto_scaling_from_template_version__latest():
|
|||||||
"LaunchTemplateName": launch_template_name,
|
"LaunchTemplateName": launch_template_name,
|
||||||
"Version": "$Latest",
|
"Version": "$Latest",
|
||||||
},
|
},
|
||||||
AvailabilityZones=["us-west-1b"],
|
AvailabilityZones=["us-west-1a"],
|
||||||
)
|
)
|
||||||
|
|
||||||
response = asg_client.describe_auto_scaling_groups(AutoScalingGroupNames=["name"])[
|
response = asg_client.describe_auto_scaling_groups(AutoScalingGroupNames=["name"])[
|
||||||
@ -185,7 +185,7 @@ def test_create_auto_scaling_from_template_version__default():
|
|||||||
"LaunchTemplateName": launch_template_name,
|
"LaunchTemplateName": launch_template_name,
|
||||||
"Version": "$Default",
|
"Version": "$Default",
|
||||||
},
|
},
|
||||||
AvailabilityZones=["us-west-1b"],
|
AvailabilityZones=["us-west-1a"],
|
||||||
)
|
)
|
||||||
|
|
||||||
response = asg_client.describe_auto_scaling_groups(AutoScalingGroupNames=["name"])[
|
response = asg_client.describe_auto_scaling_groups(AutoScalingGroupNames=["name"])[
|
||||||
@ -214,7 +214,7 @@ def test_create_auto_scaling_from_template_version__no_version():
|
|||||||
MinSize=1,
|
MinSize=1,
|
||||||
MaxSize=1,
|
MaxSize=1,
|
||||||
LaunchTemplate={"LaunchTemplateName": launch_template_name},
|
LaunchTemplate={"LaunchTemplateName": launch_template_name},
|
||||||
AvailabilityZones=["us-west-1b"],
|
AvailabilityZones=["us-west-1a"],
|
||||||
)
|
)
|
||||||
|
|
||||||
response = asg_client.describe_auto_scaling_groups(AutoScalingGroupNames=["name"])[
|
response = asg_client.describe_auto_scaling_groups(AutoScalingGroupNames=["name"])[
|
||||||
@ -715,8 +715,8 @@ def test_autoscaling_describe_policies():
|
|||||||
@mock_autoscaling
|
@mock_autoscaling
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
def test_create_autoscaling_policy_with_policytype__targettrackingscaling():
|
def test_create_autoscaling_policy_with_policytype__targettrackingscaling():
|
||||||
mocked_networking = setup_networking(region_name="us-east-1")
|
mocked_networking = setup_networking(region_name="us-west-1")
|
||||||
client = boto3.client("autoscaling", region_name="us-east-1")
|
client = boto3.client("autoscaling", region_name="us-west-1")
|
||||||
configuration_name = "test"
|
configuration_name = "test"
|
||||||
asg_name = "asg_test"
|
asg_name = "asg_test"
|
||||||
|
|
||||||
@ -750,7 +750,7 @@ def test_create_autoscaling_policy_with_policytype__targettrackingscaling():
|
|||||||
policy = resp["ScalingPolicies"][0]
|
policy = resp["ScalingPolicies"][0]
|
||||||
policy.should.have.key("PolicyName").equals(configuration_name)
|
policy.should.have.key("PolicyName").equals(configuration_name)
|
||||||
policy.should.have.key("PolicyARN").equals(
|
policy.should.have.key("PolicyARN").equals(
|
||||||
f"arn:aws:autoscaling:us-east-1:{ACCOUNT_ID}:scalingPolicy:c322761b-3172-4d56-9a21-0ed9d6161d67:autoScalingGroupName/{asg_name}:policyName/{configuration_name}"
|
f"arn:aws:autoscaling:us-west-1:{ACCOUNT_ID}:scalingPolicy:c322761b-3172-4d56-9a21-0ed9d6161d67:autoScalingGroupName/{asg_name}:policyName/{configuration_name}"
|
||||||
)
|
)
|
||||||
policy.should.have.key("PolicyType").equals("TargetTrackingScaling")
|
policy.should.have.key("PolicyType").equals("TargetTrackingScaling")
|
||||||
policy.should.have.key("TargetTrackingConfiguration").should.equal(
|
policy.should.have.key("TargetTrackingConfiguration").should.equal(
|
||||||
|
@ -416,7 +416,7 @@ def test_autoscaling_group_update():
|
|||||||
"my-as-group": {
|
"my-as-group": {
|
||||||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"AvailabilityZones": ["us-west-1b"],
|
"AvailabilityZones": ["us-west-1a"],
|
||||||
"LaunchConfigurationName": {"Ref": "my-launch-config"},
|
"LaunchConfigurationName": {"Ref": "my-launch-config"},
|
||||||
"MinSize": "2",
|
"MinSize": "2",
|
||||||
"MaxSize": "2",
|
"MaxSize": "2",
|
||||||
|
@ -703,7 +703,7 @@ def test_vpc_endpoint_creation():
|
|||||||
ec2_client = boto3.client("ec2", region_name="us-west-1")
|
ec2_client = boto3.client("ec2", region_name="us-west-1")
|
||||||
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
||||||
subnet1 = ec2.create_subnet(
|
subnet1 = ec2.create_subnet(
|
||||||
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1b"
|
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
|
|
||||||
subnet_template = {
|
subnet_template = {
|
||||||
|
@ -100,7 +100,7 @@ def test_default_subnet():
|
|||||||
default_vpc.is_default.should.equal(True)
|
default_vpc.is_default.should.equal(True)
|
||||||
|
|
||||||
subnet = ec2.create_subnet(
|
subnet = ec2.create_subnet(
|
||||||
VpcId=default_vpc.id, CidrBlock="172.31.48.0/20", AvailabilityZone="us-west-1b"
|
VpcId=default_vpc.id, CidrBlock="172.31.48.0/20", AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
subnet.reload()
|
subnet.reload()
|
||||||
subnet.map_public_ip_on_launch.should.equal(False)
|
subnet.map_public_ip_on_launch.should.equal(False)
|
||||||
@ -116,7 +116,7 @@ def test_non_default_subnet():
|
|||||||
vpc.is_default.should.equal(False)
|
vpc.is_default.should.equal(False)
|
||||||
|
|
||||||
subnet = ec2.create_subnet(
|
subnet = ec2.create_subnet(
|
||||||
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1b"
|
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
subnet.reload()
|
subnet.reload()
|
||||||
subnet.map_public_ip_on_launch.should.equal(False)
|
subnet.map_public_ip_on_launch.should.equal(False)
|
||||||
@ -133,7 +133,7 @@ def test_modify_subnet_attribute_public_ip_on_launch():
|
|||||||
random_subnet_cidr = f"{random_ip}/20" # Same block as the VPC
|
random_subnet_cidr = f"{random_ip}/20" # Same block as the VPC
|
||||||
|
|
||||||
subnet = ec2.create_subnet(
|
subnet = ec2.create_subnet(
|
||||||
VpcId=vpc.id, CidrBlock=random_subnet_cidr, AvailabilityZone="us-west-1b"
|
VpcId=vpc.id, CidrBlock=random_subnet_cidr, AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
|
|
||||||
# 'map_public_ip_on_launch' is set when calling 'DescribeSubnets' action
|
# 'map_public_ip_on_launch' is set when calling 'DescribeSubnets' action
|
||||||
@ -166,7 +166,7 @@ def test_modify_subnet_attribute_assign_ipv6_address_on_creation():
|
|||||||
random_subnet_cidr = f"{random_ip}/20" # Same block as the VPC
|
random_subnet_cidr = f"{random_ip}/20" # Same block as the VPC
|
||||||
|
|
||||||
subnet = ec2.create_subnet(
|
subnet = ec2.create_subnet(
|
||||||
VpcId=vpc.id, CidrBlock=random_subnet_cidr, AvailabilityZone="us-west-1b"
|
VpcId=vpc.id, CidrBlock=random_subnet_cidr, AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
|
|
||||||
# 'map_public_ip_on_launch' is set when calling 'DescribeSubnets' action
|
# 'map_public_ip_on_launch' is set when calling 'DescribeSubnets' action
|
||||||
@ -195,7 +195,7 @@ def test_modify_subnet_attribute_validation():
|
|||||||
ec2 = boto3.resource("ec2", region_name="us-west-1")
|
ec2 = boto3.resource("ec2", region_name="us-west-1")
|
||||||
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
||||||
ec2.create_subnet(
|
ec2.create_subnet(
|
||||||
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1b"
|
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -205,14 +205,14 @@ def test_subnet_get_by_id():
|
|||||||
client = boto3.client("ec2", region_name="us-west-1")
|
client = boto3.client("ec2", region_name="us-west-1")
|
||||||
vpcA = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
vpcA = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
||||||
subnetA = ec2.create_subnet(
|
subnetA = ec2.create_subnet(
|
||||||
VpcId=vpcA.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1b"
|
VpcId=vpcA.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
vpcB = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
vpcB = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
||||||
subnetB1 = ec2.create_subnet(
|
subnetB1 = ec2.create_subnet(
|
||||||
VpcId=vpcB.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1b"
|
VpcId=vpcB.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
ec2.create_subnet(
|
ec2.create_subnet(
|
||||||
VpcId=vpcB.id, CidrBlock="10.0.1.0/24", AvailabilityZone="us-west-1c"
|
VpcId=vpcB.id, CidrBlock="10.0.1.0/24", AvailabilityZone="us-west-1b"
|
||||||
)
|
)
|
||||||
|
|
||||||
subnets_by_id = client.describe_subnets(SubnetIds=[subnetA.id, subnetB1.id])[
|
subnets_by_id = client.describe_subnets(SubnetIds=[subnetA.id, subnetB1.id])[
|
||||||
@ -236,14 +236,14 @@ def test_get_subnets_filtering():
|
|||||||
client = boto3.client("ec2", region_name="us-west-1")
|
client = boto3.client("ec2", region_name="us-west-1")
|
||||||
vpcA = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
vpcA = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
||||||
subnetA = ec2.create_subnet(
|
subnetA = ec2.create_subnet(
|
||||||
VpcId=vpcA.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1b"
|
VpcId=vpcA.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
vpcB = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
vpcB = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
||||||
subnetB1 = ec2.create_subnet(
|
subnetB1 = ec2.create_subnet(
|
||||||
VpcId=vpcB.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1b"
|
VpcId=vpcB.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
subnetB2 = ec2.create_subnet(
|
subnetB2 = ec2.create_subnet(
|
||||||
VpcId=vpcB.id, CidrBlock="10.0.1.0/24", AvailabilityZone="us-west-1c"
|
VpcId=vpcB.id, CidrBlock="10.0.1.0/24", AvailabilityZone="us-west-1b"
|
||||||
)
|
)
|
||||||
|
|
||||||
nr_of_a_zones = len(client.describe_availability_zones()["AvailabilityZones"])
|
nr_of_a_zones = len(client.describe_availability_zones()["AvailabilityZones"])
|
||||||
@ -311,7 +311,7 @@ def test_get_subnets_filtering():
|
|||||||
# Filter by availabilityZone
|
# Filter by availabilityZone
|
||||||
subnets_by_az = client.describe_subnets(
|
subnets_by_az = client.describe_subnets(
|
||||||
Filters=[
|
Filters=[
|
||||||
{"Name": "availabilityZone", "Values": ["us-west-1b"]},
|
{"Name": "availabilityZone", "Values": ["us-west-1a"]},
|
||||||
{"Name": "vpc-id", "Values": [vpcB.id]},
|
{"Name": "vpc-id", "Values": [vpcB.id]},
|
||||||
]
|
]
|
||||||
)["Subnets"]
|
)["Subnets"]
|
||||||
@ -339,7 +339,7 @@ def test_create_subnet_response_fields():
|
|||||||
|
|
||||||
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
||||||
subnet = client.create_subnet(
|
subnet = client.create_subnet(
|
||||||
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1b"
|
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a"
|
||||||
)["Subnet"]
|
)["Subnet"]
|
||||||
|
|
||||||
subnet.should.have.key("AvailabilityZone")
|
subnet.should.have.key("AvailabilityZone")
|
||||||
@ -372,7 +372,7 @@ def test_describe_subnet_response_fields():
|
|||||||
|
|
||||||
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
||||||
subnet_object = ec2.create_subnet(
|
subnet_object = ec2.create_subnet(
|
||||||
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1b"
|
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
|
|
||||||
subnets = client.describe_subnets(SubnetIds=[subnet_object.id])["Subnets"]
|
subnets = client.describe_subnets(SubnetIds=[subnet_object.id])["Subnets"]
|
||||||
@ -734,11 +734,11 @@ def test_describe_subnets_by_vpc_id():
|
|||||||
|
|
||||||
vpc1 = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
vpc1 = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
||||||
subnet1 = ec2.create_subnet(
|
subnet1 = ec2.create_subnet(
|
||||||
VpcId=vpc1.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1b"
|
VpcId=vpc1.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
vpc2 = ec2.create_vpc(CidrBlock="172.31.0.0/16")
|
vpc2 = ec2.create_vpc(CidrBlock="172.31.0.0/16")
|
||||||
subnet2 = ec2.create_subnet(
|
subnet2 = ec2.create_subnet(
|
||||||
VpcId=vpc2.id, CidrBlock="172.31.48.0/20", AvailabilityZone="us-west-1c"
|
VpcId=vpc2.id, CidrBlock="172.31.48.0/20", AvailabilityZone="us-west-1b"
|
||||||
)
|
)
|
||||||
|
|
||||||
subnets = client.describe_subnets(
|
subnets = client.describe_subnets(
|
||||||
@ -773,7 +773,7 @@ def test_describe_subnets_by_state():
|
|||||||
|
|
||||||
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
||||||
ec2.create_subnet(
|
ec2.create_subnet(
|
||||||
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1b"
|
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
|
|
||||||
subnets = client.describe_subnets(
|
subnets = client.describe_subnets(
|
||||||
@ -790,7 +790,7 @@ def test_associate_subnet_cidr_block():
|
|||||||
|
|
||||||
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
||||||
subnet_object = ec2.create_subnet(
|
subnet_object = ec2.create_subnet(
|
||||||
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1b"
|
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
|
|
||||||
subnets = client.describe_subnets(SubnetIds=[subnet_object.id])["Subnets"]
|
subnets = client.describe_subnets(SubnetIds=[subnet_object.id])["Subnets"]
|
||||||
@ -822,7 +822,7 @@ def test_disassociate_subnet_cidr_block():
|
|||||||
|
|
||||||
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
||||||
subnet_object = ec2.create_subnet(
|
subnet_object = ec2.create_subnet(
|
||||||
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1b"
|
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a"
|
||||||
)
|
)
|
||||||
|
|
||||||
client.associate_subnet_cidr_block(
|
client.associate_subnet_cidr_block(
|
||||||
|
@ -251,7 +251,7 @@ def test_describe_vpc_default_endpoint_services():
|
|||||||
)
|
)
|
||||||
details = config_service["ServiceDetails"][0]
|
details = config_service["ServiceDetails"][0]
|
||||||
assert details["AcceptanceRequired"] is False
|
assert details["AcceptanceRequired"] is False
|
||||||
assert details["AvailabilityZones"] == ["us-west-1b", "us-west-1c"]
|
assert details["AvailabilityZones"] == ["us-west-1a", "us-west-1b"]
|
||||||
assert details["BaseEndpointDnsNames"] == ["config.us-west-1.vpce.amazonaws.com"]
|
assert details["BaseEndpointDnsNames"] == ["config.us-west-1.vpce.amazonaws.com"]
|
||||||
assert details["ManagesVpcEndpoints"] is False
|
assert details["ManagesVpcEndpoints"] is False
|
||||||
assert details["Owner"] == "amazon"
|
assert details["Owner"] == "amazon"
|
||||||
|
@ -18,7 +18,7 @@ def test_stack_elb_integration_with_attached_ec2_instances():
|
|||||||
"Properties": {
|
"Properties": {
|
||||||
"Instances": [{"Ref": "Ec2Instance1"}],
|
"Instances": [{"Ref": "Ec2Instance1"}],
|
||||||
"LoadBalancerName": "test-elb",
|
"LoadBalancerName": "test-elb",
|
||||||
"AvailabilityZones": ["us-west-1b"],
|
"AvailabilityZones": ["us-west-1a"],
|
||||||
"Listeners": [
|
"Listeners": [
|
||||||
{
|
{
|
||||||
"InstancePort": "80",
|
"InstancePort": "80",
|
||||||
@ -47,7 +47,7 @@ def test_stack_elb_integration_with_attached_ec2_instances():
|
|||||||
ec2_instance = reservations["Instances"][0]
|
ec2_instance = reservations["Instances"][0]
|
||||||
|
|
||||||
load_balancer["Instances"][0]["InstanceId"].should.equal(ec2_instance["InstanceId"])
|
load_balancer["Instances"][0]["InstanceId"].should.equal(ec2_instance["InstanceId"])
|
||||||
load_balancer["AvailabilityZones"].should.equal(["us-west-1b"])
|
load_balancer["AvailabilityZones"].should.equal(["us-west-1a"])
|
||||||
|
|
||||||
|
|
||||||
@mock_elb
|
@mock_elb
|
||||||
@ -105,7 +105,7 @@ def test_stack_elb_integration_with_update():
|
|||||||
"Type": "AWS::ElasticLoadBalancing::LoadBalancer",
|
"Type": "AWS::ElasticLoadBalancing::LoadBalancer",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"LoadBalancerName": "test-elb",
|
"LoadBalancerName": "test-elb",
|
||||||
"AvailabilityZones": ["us-west-1c"],
|
"AvailabilityZones": ["us-west-1a"],
|
||||||
"Listeners": [
|
"Listeners": [
|
||||||
{
|
{
|
||||||
"InstancePort": "80",
|
"InstancePort": "80",
|
||||||
@ -127,7 +127,7 @@ def test_stack_elb_integration_with_update():
|
|||||||
# then
|
# then
|
||||||
elb = boto3.client("elb", region_name="us-west-1")
|
elb = boto3.client("elb", region_name="us-west-1")
|
||||||
load_balancer = elb.describe_load_balancers()["LoadBalancerDescriptions"][0]
|
load_balancer = elb.describe_load_balancers()["LoadBalancerDescriptions"][0]
|
||||||
load_balancer["AvailabilityZones"].should.equal(["us-west-1c"])
|
load_balancer["AvailabilityZones"].should.equal(["us-west-1a"])
|
||||||
|
|
||||||
# when
|
# when
|
||||||
elb_template["Resources"]["MyELB"]["Properties"]["AvailabilityZones"] = [
|
elb_template["Resources"]["MyELB"]["Properties"]["AvailabilityZones"] = [
|
||||||
|
@ -76,10 +76,10 @@ def test_create_elb_using_subnetmapping():
|
|||||||
)
|
)
|
||||||
vpc = ec2.create_vpc(CidrBlock="172.28.7.0/24", InstanceTenancy="default")
|
vpc = ec2.create_vpc(CidrBlock="172.28.7.0/24", InstanceTenancy="default")
|
||||||
subnet1 = ec2.create_subnet(
|
subnet1 = ec2.create_subnet(
|
||||||
VpcId=vpc.id, CidrBlock="172.28.7.0/26", AvailabilityZone=region + "b"
|
VpcId=vpc.id, CidrBlock="172.28.7.0/26", AvailabilityZone=region + "a"
|
||||||
)
|
)
|
||||||
subnet2 = ec2.create_subnet(
|
subnet2 = ec2.create_subnet(
|
||||||
VpcId=vpc.id, CidrBlock="172.28.7.192/26", AvailabilityZone=region + "c"
|
VpcId=vpc.id, CidrBlock="172.28.7.192/26", AvailabilityZone=region + "b"
|
||||||
)
|
)
|
||||||
|
|
||||||
conn.create_load_balancer(
|
conn.create_load_balancer(
|
||||||
@ -93,10 +93,10 @@ def test_create_elb_using_subnetmapping():
|
|||||||
lb = conn.describe_load_balancers()["LoadBalancers"][0]
|
lb = conn.describe_load_balancers()["LoadBalancers"][0]
|
||||||
lb.should.have.key("AvailabilityZones").length_of(2)
|
lb.should.have.key("AvailabilityZones").length_of(2)
|
||||||
lb["AvailabilityZones"].should.contain(
|
lb["AvailabilityZones"].should.contain(
|
||||||
{"ZoneName": "us-west-1b", "SubnetId": subnet1.id}
|
{"ZoneName": "us-west-1a", "SubnetId": subnet1.id}
|
||||||
)
|
)
|
||||||
lb["AvailabilityZones"].should.contain(
|
lb["AvailabilityZones"].should.contain(
|
||||||
{"ZoneName": "us-west-1c", "SubnetId": subnet2.id}
|
{"ZoneName": "us-west-1b", "SubnetId": subnet2.id}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -240,10 +240,10 @@ def test_create_elb_in_multiple_region():
|
|||||||
)
|
)
|
||||||
vpc = ec2.create_vpc(CidrBlock="172.28.7.0/24", InstanceTenancy="default")
|
vpc = ec2.create_vpc(CidrBlock="172.28.7.0/24", InstanceTenancy="default")
|
||||||
subnet1 = ec2.create_subnet(
|
subnet1 = ec2.create_subnet(
|
||||||
VpcId=vpc.id, CidrBlock="172.28.7.0/26", AvailabilityZone=region + "b"
|
VpcId=vpc.id, CidrBlock="172.28.7.0/26", AvailabilityZone=region + "a"
|
||||||
)
|
)
|
||||||
subnet2 = ec2.create_subnet(
|
subnet2 = ec2.create_subnet(
|
||||||
VpcId=vpc.id, CidrBlock="172.28.7.192/26", AvailabilityZone=region + "c"
|
VpcId=vpc.id, CidrBlock="172.28.7.192/26", AvailabilityZone=region + "b"
|
||||||
)
|
)
|
||||||
|
|
||||||
conn.create_load_balancer(
|
conn.create_load_balancer(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user