MCPcopy Create free account
hub / github.com/aws-samples/aws-cdk-examples / LoadBalancerStack

Class LoadBalancerStack

python/classic-load-balancer/app.py:9–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7
8
9class LoadBalancerStack(Stack):
10 def __init__(self, app: App, id: str, **kwargs) -> None:
11 super().__init__(app, id, **kwargs)
12
13 vpc = ec2.Vpc(self, "VPC")
14
15 asg = autoscaling.AutoScalingGroup(
16 self, "ASG",
17 vpc=vpc,
18 instance_type=ec2.InstanceType.of(
19 ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO
20 ),
21 machine_image=ec2.AmazonLinuxImage(),
22 )
23
24 lb = elb.LoadBalancer(
25 self, "LB",
26 vpc=vpc,
27 internet_facing=True,
28 health_check=elb.HealthCheck(port=80)
29 )
30 lb.add_target(asg)
31
32 listener = lb.add_listener(external_port=80)
33 listener.connections.allow_default_port_from_any_ipv4("Open to the world")
34
35
36app = App()

Callers 1

app.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected