Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Python examples to 0.36.1 #64

Merged
merged 4 commits into from
Jul 3, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions python/ecs/ecs-service-with-advanced-alb-config/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
aws_ec2 as ec2,
aws_ecs as ecs,
aws_elasticloadbalancingv2 as elbv2,
cdk,
core,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have been importing core types directly lately, so instead of core.Type it’s just Type. Not critical, but that’s what we are doing in TypeScript at least.

)

app = cdk.App()
stack = cdk.Stack(app, "aws-ec2-integ-ecs")
app = core.App()
stack = core.Stack(app, "aws-ec2-integ-ecs")

# Create a cluster
vpc = ec2.Vpc(
Expand All @@ -32,7 +32,7 @@
container.add_port_mappings(
container_port=80,
host_port=8080,
protocol=ecs.Protocol.Tcp
protocol=ecs.Protocol.TCP
)

# Create Service
Expand Down Expand Up @@ -66,9 +66,9 @@
}
)

cdk.CfnOutput(
core.CfnOutput(
stack, "LoadBalancerDNS",
value=lb.load_balancer_dns_name
)

app.run()
app.synth()
17 changes: 10 additions & 7 deletions python/ecs/ecs-service-with-task-placement/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
aws_ec2 as ec2,
aws_ecs as ecs,
aws_elasticloadbalancingv2 as elbv2,
cdk,
core,
)

app = cdk.App()
stack = cdk.Stack(app, "aws-ecs-integ-ecs")
app = core.App()
stack = core.Stack(app, "aws-ecs-integ-ecs")

# Create a cluster
vpc = ec2.Vpc(
Expand Down Expand Up @@ -37,7 +37,7 @@
container.add_port_mappings(
container_port=80,
host_port=8080,
protocol=ecs.Protocol.Tcp
protocol=ecs.Protocol.TCP
)

# Create Service
Expand All @@ -46,7 +46,10 @@
cluster=cluster,
task_definition=task_definition,
)
service.place_packed_by(ecs.BinPackResource.Memory)
service.place_spread_across(ecs.BuiltInAttributes.AVAILABILITY_ZONE)

app.run()
service.add_placement_strategies(
ecs.PlacementStrategy.packed_by(ecs.BinPackResource.MEMORY))
service.add_placement_strategies(
ecs.PlacementStrategy.spread_across(
ecs.BuiltInAttributes.AVAILABILITY_ZONE))
app.synth()