-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat: construct library for ECS #1041
Closed
Closed
Changes from 1 commit
Commits
Show all changes
113 commits
Select commit
Hold shift + click to select a range
939452c
Ignore swp files
SoManyHs 7302a2f
Add ECS lib and example
SoManyHs 4c7127a
Add service and task def constructs
SoManyHs 98749ec
WIP adding VPC/ASG
SoManyHs 6d0942f
Refactor ECS demo
bddfe56
Add more props on Service
SoManyHs 3574611
Add TODO for AMI IDs
SoManyHs a63c377
Weird hack?
SoManyHs b00e0dd
Update example to instantiate service separately
SoManyHs 80ba2e4
WIP Add Container Definitions
SoManyHs 0980f52
WIP Add other Task Def properties
SoManyHs 8648540
Merge remote-tracking branch 'official/master' into ecs-demo
2d53d89
Indentation 4 -> 2
dbdab86
Fix type errors
ee6b427
Use SSM parameter for ECS Optimized AMI
SoManyHs 2b16dad
Move containerdefinition to its own file
16a92c0
Merge branch 'ecs-demo' of github.com:SoManyHs/aws-cdk into ecs-demo
ae881c2
Turning ContainerDefinition into a construct
0672e6a
Add enum for placement constraints
SoManyHs 4f93a5b
Rename fleet to autoScalingGroup
SoManyHs 9b61b89
Qualify "PlacementConstraintType" usage with package name
98bf81b
ECR can return itself as container image
ae1d525
Automatically generate execution and task roles
23072a9
Make taskRole public
e5cc7f2
Remove shellCommand from healthCheck
SoManyHs 047eed8
Rename toContainerDefinitionJson to renderContainerDefinition
SoManyHs 65d3f79
Some work on Service
11541d3
Merge branch 'ecs-demo' of github.com:SoManyHs/aws-cdk into ecs-demo
fb17532
Separate Fargate and ECS clusters
SoManyHs be8cb86
Separate ECS and Fargate Service
SoManyHs b8cce3a
Separate ECS/Fargate TaskDefinition
SoManyHs 2741608
Fix lint errors
SoManyHs a901912
Fix lint errors
SoManyHs a91bda7
Merge branch 'ecs-demo' of github.com:SoManyHs/aws-cdk into ecs-demo
51adff5
Fix bugs in service and task def
SoManyHs 70ae682
Fix AMI ID getter for ECS clusters
SoManyHs 298e0a7
Add Capabilities in Linux Parameters on ContainerDefs
SoManyHs 1541edd
Add Capabilities in Linux Parameters on ContainerDefs
SoManyHs a154d09
Add default arg to SSMProvider.getString
SoManyHs 4b46685
Add Devices to LinuxParameters
SoManyHs 9875c6e
Add Tmpfs to LinuxParameters
SoManyHs 1044d1c
Update ecs demo with full Linux Parameters example
SoManyHs e7f8000
Rename renderLogDriver
SoManyHs e7f7b7d
Do most of Service
dda869d
Merge branch 'ecs-demo' of github.com:SoManyHs/aws-cdk into ecs-demo
97083dc
Add Ulimits
SoManyHs a3e3615
Fix log driver
SoManyHs b913f0e
Make add* functions consistently plural
SoManyHs fd21c0d
Make load balancers respect network mode
3b4695c
Merge branch 'ecs-demo' of github.com:SoManyHs/aws-cdk into ecs-demo
187f62b
Make add* functions consistently plural
SoManyHs 6912e3f
Add portMappings to ContainerDefinition
SoManyHs 2bf2d57
Missing semicolons
SoManyHs f477d8d
Add MountPoints to ContainerDefinition
SoManyHs b947f51
Change 'addContainer' to take the props and return ContainerDefinition.
ab83d35
Merge branch 'ecs-demo' of github.com:SoManyHs/aws-cdk into ecs-demo
30cb925
Add VolumesFrom to ContainerDefinition
SoManyHs c64e184
Add fargate example for demo purposes
SoManyHs 566aac3
Remove Service Role, fix DesiredCount default, make task memory defin…
96e3105
Merge branch 'ecs-demo' of github.com:SoManyHs/aws-cdk into ecs-demo
48cd8d4
Starting on port mapping defaults
e311293
Add validation on port mappings with tests
SoManyHs 4ffed09
Implement ingressPort method
SoManyHs 97d3db3
Make ALB listener ACTUALLY default to 'true'
4f9b548
Add dependency on listener
SoManyHs e8aa186
Integ test for Fargate service
SoManyHs eb4a562
Merge branch 'ecs-demo' of github.com:SoManyHs/aws-cdk into ecs-demo
e06a3ec
Add VolumesFrom to ContainerDefinition
SoManyHs 95b8d84
Add fargate example for demo purposes
SoManyHs 5595707
Starting on port mapping defaults
a1b78f4
Make ALB listener ACTUALLY default to 'true'
6f08406
Add validation on port mappings with tests
SoManyHs 5312362
Implement ingressPort method
SoManyHs 6f42026
Add dependency on listener
SoManyHs 1983858
Integ test for Fargate service
SoManyHs 4ea6b8b
hello-cdk-fargate example works
SoManyHs e34d515
Add lazy evaluation of network configuration property
SoManyHs bf90c27
Add LoadBalancedFargateService L3 construct
SoManyHs ffbad9f
Start LoadBalancedFargateServiceApplet
SoManyHs d1b22bd
Application AutoScaling WIP
7840634
Merge branch 'ecs-demo' of github.com:SoManyHs/aws-cdk into ecs-demo
d1ec640
Make declarative example work
36e1ba2
Add import exports to Cluster
SoManyHs 178898f
Fix portMappings/ingressPort
SoManyHs b73bdad
Clean up fargate integ test
SoManyHs 049557e
Add integ test for load balanced service in bridge mode
SoManyHs 2295ef2
Add integ test for awsvpc network mode on EcsCluster
SoManyHs f34c23c
Fix ingress/containerPort on LBs
SoManyHs c491a1d
Cleanup example
SoManyHs 430f81e
Add cloudwatch metrics
SoManyHs dca6972
Bridge mode works with host port specified
SoManyHs cf528d6
Merge remote-tracking branch 'origin/master' into ecs-demo
ef51786
Fix libs to be in line with latest API changes from master
c3b543a
Merge remote-tracking branch 'origin/master' into ecs-demo
64b6d06
Fix build errors
af5a2a4
Merge remote-tracking branch 'origin/master' into ecs-demo
51097fd
Fix ingressPort/containerPort tests
SoManyHs 7b19dd2
Add LoadBalancedEcsService L3 Construct
SoManyHs 9bea6be
Add ability to specify cluster size
SoManyHs 4ab455c
Merge remote-tracking branch 'origin/master' into ecs-demo
be9f447
feat(aws-ecs): add Task AutoScaling to Service
2eab513
Add unit tests for EcsCluster
SoManyHs 57857a9
Merge branch 'master' into ecs-demo
SoManyHs 4cf23fc
Unit tests for Cluster
SoManyHs 37d3c4e
Set volumes on TaskDefinition
SoManyHs 1ad3669
Clarify doc string for memoryLimit and memoryReservation
SoManyHs 78d2a49
WIP Unit tests on EcsTaskDefinition
SoManyHs ca61a74
WIP Unit tests for EcsService
SoManyHs 98345b3
WIP Unit tests for FargateService
SoManyHs 35ebd9c
WIP unit tests Fargate Task Definition
SoManyHs 09a182a
Merge branch 'huijbers/autoscaling' into ecs-demo
2fd2e7c
Add docs and readme and a couple of tests
9825127
Unit test for error case on service creation
SoManyHs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add ECS lib and example
- Loading branch information
commit 7302a2f4250659f5e12c6ea6c9a2264e6f92b885
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"app": "node index", | ||
"context": { | ||
"availability-zones:585695036304:us-east-1": [ | ||
"us-east-1a", | ||
"us-east-1b", | ||
"us-east-1c", | ||
"us-east-1d", | ||
"us-east-1e", | ||
"us-east-1f" | ||
], | ||
"ssm:585695036304:us-east-1:/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2": "ami-14c5486b", | ||
"availability-zones:585695036304:eu-west-2": [ | ||
"eu-west-2a", | ||
"eu-west-2b", | ||
"eu-west-2c" | ||
], | ||
"ssm:585695036304:eu-west-2:/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2": "ami-a36f8dc4", | ||
"availability-zones:585695036304:eu-west-1": [ | ||
"eu-west-1a", | ||
"eu-west-1b", | ||
"eu-west-1c" | ||
], | ||
"ssm:585695036304:eu-west-1:/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2": "ami-ca0135b3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import ecs = require('@aws-cdk/aws-ecs'); | ||
import cdk = require('@aws-cdk/cdk'); | ||
|
||
class HelloECS extends cdk.Stack { | ||
constructor(parent: cdk.App, name: string, props?: cdk.StackProps) { | ||
super(parent, name, props); | ||
new ecs.Cluster(this, 'MyCluster'); | ||
} | ||
} | ||
|
||
const app = new cdk.App(process.argv); | ||
|
||
new HelloECS(app, 'Hello'); | ||
|
||
process.stdout.write(app.run()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import autoscaling = require('@aws-cdk/aws-autoscaling'); | ||
import ec2 = require('@aws-cdk/aws-ec2'); | ||
import cdk = require('@aws-cdk/cdk'); | ||
import { cloudformation, ClusterArn} from './ecs.generated'; | ||
|
||
export interface ClusterProps { | ||
/** | ||
* A name for the cluster. | ||
* @default CloudFormation-generated name | ||
*/ | ||
clusterName?: string; | ||
|
||
vpc: ec2.VpcNetworkRef; | ||
|
||
asg: autoscaling.AutoScalingGroup; | ||
} | ||
|
||
export class ClusterName extends cdk.Token { | ||
} | ||
|
||
export class Cluster extends cdk.Construct { | ||
|
||
public readonly clusterArn: ClusterArn; | ||
|
||
public readonly clusterName: ClusterName; | ||
|
||
constructor(parent: cdk.Construct, name: string, props: ClusterProps = {}) { | ||
super(parent, name); | ||
|
||
const cluster = new cloudformation.ClusterResource(this, "Resource", {clusterName: props.clusterName}); | ||
|
||
this.clusterArn = cluster.clusterArn; | ||
|
||
this.clusterName = new ClusterName(cluster.ref); | ||
|
||
const taskDef = new cloudformation.TaskDefinitionResource(this, "TaskDef", { | ||
family: "Service", | ||
memory: "512", | ||
cpu: "256", | ||
containerDefinitions: [{ | ||
name: "web", | ||
image: "amazon/amazon-ecs-sample", | ||
cpu: 10, | ||
memory: 1024, | ||
essential: true | ||
}] | ||
}); | ||
|
||
new cloudformation.ServiceResource(this, "Service", { | ||
cluster: this.clusterName, | ||
taskDefinition: taskDef.ref, | ||
desiredCount: 1, | ||
deploymentConfiguration: { | ||
maximumPercent: 200, | ||
minimumHealthyPercent: 75 | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
// AWS::ECS CloudFormation Resources: | ||
export * from './ecs.generated'; | ||
export * from './cluster'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it normal practice in the CDK to check in account IDs? Normally we avoid publicly sharing account IDs...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. We should definitely delete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this should not have been checked in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we expect customers to check this in to their repos, or should cdk.json generally be git'ignored? Should cdk init add that to a .gitignore file? Sounds like we need a separate issue to track that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi this stuff is online for all to see