Skip to content

Commit 2f8d707

Browse files
authored
Update examples to 0.29.0 (aws-samples#35)
- Automatically test Python examples - Remove chat-app examples
1 parent db155d2 commit 2f8d707

File tree

31 files changed

+877
-1417
lines changed

31 files changed

+877
-1417
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ package-lock.json
66
__pycache__
77
.env
88
*~
9+
.cdk.staging

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ $ cdk destroy
2121
| Example | Description |
2222
|---------|-------------|
2323
| [application-load-balancer](https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/application-load-balancer/) | Using an AutoScalingGroup with an Application Load Balancer |
24-
| [chat-app](https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/chat-app/) | A serverless chat application using Cognito |
2524
| [classic-load-balancer](https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/classic-load-balancer/) | Using an AutoScalingGroup with a Classic Load Balancer |
2625
| [custom-resource](https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/custom-resource/) | Shows adding a Custom Resource to your CDK app |
2726
| [elasticbeanstalk](https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/elasticbeanstalk/) | Elastic Beanstalk example using L1 with a Blue/Green pipeline (community contributed) |
@@ -57,6 +56,35 @@ $ cdk destroy
5756
|---------|-------------|
5857
| [hello-world](https://github.com/aws-samples/aws-cdk-examples/tree/master/java/hello-world/) | A demo application that uses the CDK in Java |
5958

59+
## Python examples
60+
61+
To run a Python example, say my-widget-service:
62+
63+
```
64+
$ npm install -g aws-cdk
65+
$ cd python/my-widget-service
66+
$ pip install -r requirements.txt # Best to do this in a virtualenv
67+
$ cdk deploy # Deploys the CloudFormation template
68+
69+
# Afterwards
70+
$ cdk destroy
71+
```
72+
73+
| Example | Description |
74+
|---------|-------------|
75+
| [application-load-balancer](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/application-load-balancer/) | Using an AutoScalingGroup with an Application Load Balancer |
76+
| [classic-load-balancer](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/classic-load-balancer/) | Using an AutoScalingGroup with a Classic Load Balancer |
77+
| [custom-resource](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/custom-resource/) | Shows adding a Custom Resource to your CDK app |
78+
| [ecs-cluster](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/ecs/cluster/) | Provision an ECS Cluster with custom Autoscaling Group configuration |
79+
| [ecs-load-balanced-service](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/ecs/ecs-load-balanced-service/) | Starting a container fronted by a load balancer on ECS |
80+
| [ecs-service-with-task-placement](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/ecs/ecs-service-with-task-placement/) | Starting a container ECS with task placement specifications |
81+
| [ecs-service-with-advanced-alb-config](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/ecs/ecs-service-with-advanced-alb-config/) | Starting a container fronted by a load balancer on ECS with added load balancer configuration |
82+
| [ecs-service-with-task-networking](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/ecs/ecs-service-with-task-networking/) | Starting an ECS service with task networking, allowing ingress traffic to the task but blocking for the instance |
83+
| [fargate-load-balanced-service](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/ecs/fargate-load-balanced-service/) | Starting a container fronted by a load balancer on Fargate |
84+
| [fargate-service-with-auto-scaling](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/ecs/fargate-service-with-auto-scaling/) | Starting an ECS service of FARGATE launch type that auto scales based on average CPU Utilization |
85+
| [lambda-cron](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/lambda-cron/) | Running a Lambda on a schedule |
86+
| [stepfunctions-job-poller](https://github.com/aws-samples/aws-cdk-examples/tree/master/python/stepfunctions-job-poller/) | A simple StepFunctions workflow |
87+
6088
## JavaScript examples
6189

6290
Select the following link to see how to install and run the example.

python/chat-app/app.py

Lines changed: 0 additions & 107 deletions
This file was deleted.

python/chat-app/cdk.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

python/chat-app/cognito_chat_room_pool.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

python/chat-app/dynamodb_posts_table.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

python/chat-app/requirements.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

python/ecs/cluster/app.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ def __init__(self, scope: cdk.Construct, id: str, **kwargs) -> None:
2323
associate_public_ip_address=True,
2424
update_type=autoscaling.UpdateType.ReplacingUpdate,
2525
desired_capacity=3,
26-
vpc=vpc
26+
vpc=vpc,
27+
vpc_subnets={'subnetType': ec2.SubnetType.Public}
2728
)
2829

2930
cluster = ecs.Cluster(
3031
self, 'EcsCluster',
3132
vpc=vpc
3233
)
3334

34-
cluster.add_autoscaling_group(asg)
35+
cluster.add_auto_scaling_group(asg)
3536
cluster.add_capacity("DefaultAutoScalingGroup",
3637
instance_type=ec2.InstanceType("t2.micro"))
3738

python/ecs/ecs-service-with-task-placement/DO_NOT_AUTOTEST

Whitespace-only changes.

python/lambda-cron/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from aws_cdk import aws_events as events, aws_lambda as lambda_, cdk
1+
from aws_cdk import aws_events as events, aws_lambda as lambda_, cdk, aws_events_targets as targets
22

33

44
class LambdaCronStack(cdk.Stack):
@@ -22,7 +22,7 @@ def __init__(self, app: cdk.App, id: str) -> None:
2222
rule = events.EventRule(
2323
self, "Rule", schedule_expression="cron(0 18 ? * MON-FRI *)"
2424
)
25-
rule.add_target(lambdaFn)
25+
rule.add_target(targets.LambdaFunction(lambdaFn))
2626

2727

2828
app = cdk.App()

0 commit comments

Comments
 (0)