lb2
This commit is contained in:
parent
57ce363575
commit
350c560e5d
8
lb2.py
8
lb2.py
@ -36,11 +36,11 @@ def create_vpc(ec2_client):
|
|||||||
return vpc_id
|
return vpc_id
|
||||||
|
|
||||||
|
|
||||||
def create_subnet(ec2_client, vpc_id, availability_zone):
|
def create_subnet(ec2_client, vpc_id, cidr_block, availability_zone):
|
||||||
# Create subnet
|
# Create subnet
|
||||||
response = ec2_client.create_subnet(
|
response = ec2_client.create_subnet(
|
||||||
VpcId=vpc_id,
|
VpcId=vpc_id,
|
||||||
CidrBlock='10.0.1.0/24',
|
CidrBlock=cidr_block,
|
||||||
AvailabilityZone=availability_zone,
|
AvailabilityZone=availability_zone,
|
||||||
TagSpecifications=[
|
TagSpecifications=[
|
||||||
{
|
{
|
||||||
@ -266,11 +266,11 @@ def main():
|
|||||||
|
|
||||||
# Create first subnet
|
# Create first subnet
|
||||||
print("Creating first subnet...")
|
print("Creating first subnet...")
|
||||||
subnet_id_1 = create_subnet(ec2_client, vpc_id, availability_zone='us-east-1a')
|
subnet_id_1 = create_subnet(ec2_client, vpc_id, cidr_block='10.0.1.0/24', availability_zone='us-east-1a')
|
||||||
|
|
||||||
# Create second subnet
|
# Create second subnet
|
||||||
print("Creating second subnet...")
|
print("Creating second subnet...")
|
||||||
subnet_id_2 = create_subnet(ec2_client, vpc_id, availability_zone='us-east-1b')
|
subnet_id_2 = create_subnet(ec2_client, vpc_id, cidr_block='10.0.2.0/24', availability_zone='us-east-1b')
|
||||||
|
|
||||||
# Create Internet Gateway
|
# Create Internet Gateway
|
||||||
print("Creating Internet Gateway...")
|
print("Creating Internet Gateway...")
|
||||||
|
Loading…
Reference in New Issue
Block a user