Skip to content

Commit

Permalink
chore(ecs): add test and docs for using ARM instances (aws#14536)
Browse files Browse the repository at this point in the history
Closes aws#14433


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
SoManyHs authored and hollanddd committed Aug 26, 2021
1 parent d63c276 commit 82ad543
Show file tree
Hide file tree
Showing 5 changed files with 892 additions and 1 deletion.
16 changes: 16 additions & 0 deletions packages/@aws-cdk/aws-ecs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,22 @@ cluster.addCapacity('bottlerocket-asg', {
});
```

### ARM64 (Graviton) Instances

To launch instances with ARM64 hardware, you can use the Amazon ECS-optimized
Amazon Linux 2 (arm64) AMI. Based on Amazon Linux 2, this AMI is recommended
for use when launching your EC2 instances that are powered by Arm-based AWS
Graviton Processors.

```ts
cluster.addCapacity('graviton-cluster', {
minCapacity: 2,
instanceType: new ec2.InstanceType('c6g.large'),
machineImage: ecs.EcsOptimizedImage.amazonLinux2(ecs.AmiHardwareType.ARM),
});

```

### Spot Instances

To add spot instances into the cluster, you must specify the `spotPrice` in the `ecs.AddCapacityOptions` and optionally enable the `spotInstanceDraining` property.
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ecs/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ export enum WindowsOptimizedVersion {
/*
* TODO:v2.0.0
* * remove `export` keyword
* * remove @depracted
* * remove @deprecated
*/
/**
* The properties that define which ECS-optimized AMI is used.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,17 @@ nodeunitShim({
test.done();
},

'allows returning the correct image for linux 2 for EcsOptimizedImage with ARM hardware'(test: Test) {
// GIVEN
const stack = new cdk.Stack();

test.equal(ecs.EcsOptimizedImage.amazonLinux2(ecs.AmiHardwareType.ARM).getImage(stack).osType,
ec2.OperatingSystemType.LINUX);

test.done();
},


'allows returning the correct image for windows for EcsOptimizedImage'(test: Test) {
// GIVEN
const stack = new cdk.Stack();
Expand Down
Loading

0 comments on commit 82ad543

Please sign in to comment.