Skip to content

Commit

Permalink
Merge branch 'master' into aws-iot-actions-firehose
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Nov 12, 2021
2 parents ae9cb88 + df30d4f commit 645766d
Show file tree
Hide file tree
Showing 119 changed files with 5,549 additions and 661 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/issue-label-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,8 @@ jobs:
{"area":"@aws-cdk/region-info","keywords":["region-info","fact"],"labels":["@aws-cdk/region-info"],"assignees":["skinny85"]},
{"area":"aws-cdk-lib","keywords":["aws-cdk-lib","cdk-v2","v2","ubergen"],"labels":["aws-cdk-lib"],"assignees":["nija-at"]},
{"area":"monocdk","keywords":["monocdk","monocdk-experiment"],"labels":["monocdk"],"assignees":["nija-at"]},
{"area":"@aws-cdk/yaml-cfn","keywords":["(aws-yaml-cfn)","(yaml-cfn)"],"labels":["@aws-cdk/aws-yaml-cfn"],"assignees":["skinny85"]}
{"area":"@aws-cdk/yaml-cfn","keywords":["(aws-yaml-cfn)","(yaml-cfn)"],"labels":["@aws-cdk/aws-yaml-cfn"],"assignees":["skinny85"]},
{"area":"@aws-cdk/aws-apprunner","keywords":["apprunner","aws-apprunner"],"labels":["@aws-cdk/aws-apprunner"],"assignees":["corymhall"]},
{"area":"@aws-cdk/aws-lightsail","keywords":["lightsail","aws-lightsail"],"labels":["@aws-cdk/aws-lightsail"],"assignees":["corymhall"]},
{"area":"@aws-cdk/aws-aps","keywords":["aps","aws-aps","prometheus"],"labels":["@aws-cdk/aws-aps"],"assignees":["corymhall"]}
]
19 changes: 7 additions & 12 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ pull_request_rules:
actions:
comment:
message: Thank you for contributing! Your pull request will be automatically updated and merged (do not update manually, and be sure to [allow changes to be pushed to your fork](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork)).
merge:
strict: smart
queue:
name: default
method: squash
strict_method: merge
commit_message: title+body
conditions:
- base!=release
Expand All @@ -60,11 +59,9 @@ pull_request_rules:
actions:
comment:
message: Thank you for contributing! Your pull request will be automatically updated and merged without squashing (do not update manually, and be sure to [allow changes to be pushed to your fork](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork)).
merge:
strict: smart
# Merge instead of squash
queue:
name: default
method: merge
strict_method: merge
commit_message: title+body
conditions:
- -title~=(WIP|wip)
Expand Down Expand Up @@ -106,12 +103,10 @@ pull_request_rules:
actions:
comment:
message: Thanks Dependabot!
merge:
# 'strict: false' disables Mergify keeping the branch up-to-date from master.
# It's not necessary: Dependabot will do that itself.
# It's not dangerous: GitHub branch protection settings prevent merging stale branches.
strict: false
queue:
name: default
method: squash
commit_message: title+body
conditions:
- -title~=(WIP|wip)
- -label~=(blocked|do-not-merge)
Expand Down
6 changes: 5 additions & 1 deletion allowed-breaking-changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,8 @@ strengthened:@aws-cdk/aws-lambda-event-sources.ManagedKafkaEventSourceProps

# Remove IO2 from autoscaling EbsDeviceVolumeType. This value is not supported
# at the moment and was not supported in the past.
removed:@aws-cdk/aws-autoscaling.EbsDeviceVolumeType.IO2
removed:@aws-cdk/aws-autoscaling.EbsDeviceVolumeType.IO2

# Remove autoTerminationPolicy from stepfunctions-tasks EmrCreateClusterProps. This value is not supported by stepfunctions at the moment and was not supported in the past.
removed:@aws-cdk/aws-stepfunctions-tasks.EmrCreateCluster.AutoTerminationPolicyProperty
removed:@aws-cdk/aws-stepfunctions-tasks.EmrCreateClusterProps.autoTerminationPolicy
70 changes: 44 additions & 26 deletions packages/@aws-cdk/aws-batch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ In **MANAGED** mode, AWS will handle the provisioning of compute resources to ac
Below is an example of each available type of compute environment:

```ts
const defaultVpc = new ec2.Vpc(this, 'VPC');
declare const vpc: ec2.Vpc;

// default is managed
const awsManagedEnvironment = new batch.ComputeEnvironment(stack, 'AWS-Managed-Compute-Env', {
const awsManagedEnvironment = new batch.ComputeEnvironment(this, 'AWS-Managed-Compute-Env', {
computeResources: {
vpc
vpc,
}
});

const customerManagedEnvironment = new batch.ComputeEnvironment(stack, 'Customer-Managed-Compute-Env', {
managed: false // unmanaged environment
const customerManagedEnvironment = new batch.ComputeEnvironment(this, 'Customer-Managed-Compute-Env', {
managed: false, // unmanaged environment
});
```

Expand All @@ -65,7 +65,7 @@ It is possible to have AWS Batch submit spotfleet requests for obtaining compute
```ts
const vpc = new ec2.Vpc(this, 'VPC');

const spotEnvironment = new batch.ComputeEnvironment(stack, 'MySpotEnvironment', {
const spotEnvironment = new batch.ComputeEnvironment(this, 'MySpotEnvironment', {
computeResources: {
type: batch.ComputeResourceType.SPOT,
bidPercentage: 75, // Bids for resources at 75% of the on-demand price
Expand All @@ -81,7 +81,7 @@ It is possible to have AWS Batch submit jobs to be run on Fargate compute resour
```ts
const vpc = new ec2.Vpc(this, 'VPC');

const fargateSpotEnvironment = new batch.ComputeEnvironment(stack, 'MyFargateEnvironment', {
const fargateSpotEnvironment = new batch.ComputeEnvironment(this, 'MyFargateEnvironment', {
computeResources: {
type: batch.ComputeResourceType.FARGATE_SPOT,
vpc,
Expand Down Expand Up @@ -119,7 +119,8 @@ The alternative would be to use the `BEST_FIT_PROGRESSIVE` strategy in order for

Simply define your Launch Template:

```ts
```text
// This example is only available in TypeScript
const myLaunchTemplate = new ec2.CfnLaunchTemplate(this, 'LaunchTemplate', {
launchTemplateName: 'extra-storage-template',
launchTemplateData: {
Expand All @@ -129,17 +130,20 @@ const myLaunchTemplate = new ec2.CfnLaunchTemplate(this, 'LaunchTemplate', {
ebs: {
encrypted: true,
volumeSize: 100,
volumeType: 'gp2'
}
}
]
}
volumeType: 'gp2',
},
},
],
},
});
```

and use it:

```ts
declare const vpc: ec2.Vpc;
declare const myLaunchTemplate: ec2.CfnLaunchTemplate;

const myComputeEnv = new batch.ComputeEnvironment(this, 'ComputeEnv', {
computeResources: {
launchTemplate: {
Expand Down Expand Up @@ -168,6 +172,7 @@ Occasionally, you will need to deviate from the default processing AMI.
ECS Optimized Amazon Linux 2 example:

```ts
declare const vpc: ec2.Vpc;
const myComputeEnv = new batch.ComputeEnvironment(this, 'ComputeEnv', {
computeResources: {
image: new ecs.EcsOptimizedAmi({
Expand All @@ -181,11 +186,12 @@ const myComputeEnv = new batch.ComputeEnvironment(this, 'ComputeEnv', {
Custom based AMI example:

```ts
declare const vpc: ec2.Vpc;
const myComputeEnv = new batch.ComputeEnvironment(this, 'ComputeEnv', {
computeResources: {
image: ec2.MachineImage.genericLinux({
"[aws-region]": "[ami-ID]",
})
}),
vpc,
}
});
Expand All @@ -196,7 +202,8 @@ const myComputeEnv = new batch.ComputeEnvironment(this, 'ComputeEnv', {
Jobs are always submitted to a specific queue. This means that you have to create a queue before you can start submitting jobs. Each queue is mapped to at least one (and no more than three) compute environment. When the job is scheduled for execution, AWS Batch will select the compute environment based on ordinal priority and available capacity in each environment.

```ts
const jobQueue = new batch.JobQueue(stack, 'JobQueue', {
declare const computeEnvironment: batch.ComputeEnvironment;
const jobQueue = new batch.JobQueue(this, 'JobQueue', {
computeEnvironments: [
{
// Defines a collection of compute resources to handle assigned batch jobs
Expand All @@ -213,13 +220,20 @@ const jobQueue = new batch.JobQueue(stack, 'JobQueue', {
Sometimes you might have jobs that are more important than others, and when submitted, should take precedence over the existing jobs. To achieve this, you can create a priority based execution strategy, by assigning each queue its own priority:

```ts
const highPrioQueue = new batch.JobQueue(stack, 'JobQueue', {
computeEnvironments: sharedComputeEnvs,
declare const sharedComputeEnvs: batch.ComputeEnvironment;
const highPrioQueue = new batch.JobQueue(this, 'JobQueue', {
computeEnvironments: [{
computeEnvironment: sharedComputeEnvs,
order: 1,
}],
priority: 2,
});

const lowPrioQueue = new batch.JobQueue(stack, 'JobQueue', {
computeEnvironments: sharedComputeEnvs,
const lowPrioQueue = new batch.JobQueue(this, 'JobQueue', {
computeEnvironments: [{
computeEnvironment: sharedComputeEnvs,
order: 1,
}],
priority: 1,
});
```
Expand All @@ -241,9 +255,11 @@ const jobQueue = batch.JobQueue.fromJobQueueArn(this, 'imported-job-queue', 'arn
A Batch Job definition helps AWS Batch understand important details about how to run your application in the scope of a Batch Job. This involves key information like resource requirements, what containers to run, how the compute environment should be prepared, and more. Below is a simple example of how to create a job definition:

```ts
const repo = ecr.Repository.fromRepositoryName(stack, 'batch-job-repo', 'todo-list');
import * as ecr from '@aws-cdk/aws-ecr';

new batch.JobDefinition(stack, 'batch-job-def-from-ecr', {
const repo = ecr.Repository.fromRepositoryName(this, 'batch-job-repo', 'todo-list');

new batch.JobDefinition(this, 'batch-job-def-from-ecr', {
container: {
image: new ecs.EcrImage(repo, 'latest'),
},
Expand All @@ -255,7 +271,7 @@ new batch.JobDefinition(stack, 'batch-job-def-from-ecr', {
Below is an example of how you can create a Batch Job Definition from a local Docker application.

```ts
new batch.JobDefinition(stack, 'batch-job-def-from-local', {
new batch.JobDefinition(this, 'batch-job-def-from-local', {
container: {
// todo-list is a directory containing a Dockerfile to build the application
image: ecs.ContainerImage.fromAsset('../todo-list'),
Expand All @@ -268,14 +284,16 @@ new batch.JobDefinition(stack, 'batch-job-def-from-local', {
You can provide custom log driver and its configuration for the container.

```ts
new batch.JobDefinition(stack, 'job-def', {
import * as ssm from '@aws-cdk/aws-ssm';

new batch.JobDefinition(this, 'job-def', {
container: {
image: ecs.EcrImage.fromRegistry('docker/whalesay'),
logConfiguration: {
logDriver: batch.LogDriver.AWSLOGS,
options: { 'awslogs-region': 'us-east-1' },
secretOptions: [
batch.ExposedSecret.fromParametersStore('xyz', ssm.StringParameter.fromStringParameterName(stack, 'parameter', 'xyz')),
batch.ExposedSecret.fromParametersStore('xyz', ssm.StringParameter.fromStringParameterName(this, 'parameter', 'xyz')),
],
},
},
Expand Down Expand Up @@ -303,8 +321,8 @@ Below is an example:

```ts
// Without revision
const job = batch.JobDefinition.fromJobDefinitionName(this, 'imported-job-definition', 'my-job-definition');
const job1 = batch.JobDefinition.fromJobDefinitionName(this, 'imported-job-definition', 'my-job-definition');

// With revision
const job = batch.JobDefinition.fromJobDefinitionName(this, 'imported-job-definition', 'my-job-definition:3');
const job2 = batch.JobDefinition.fromJobDefinitionName(this, 'imported-job-definition', 'my-job-definition:3');
```
9 changes: 8 additions & 1 deletion packages/@aws-cdk/aws-batch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@
]
}
},
"projectReferences": true
"projectReferences": true,
"metadata": {
"jsii": {
"rosetta": {
"strict": true
}
}
}
},
"repository": {
"type": "git",
Expand Down
14 changes: 14 additions & 0 deletions packages/@aws-cdk/aws-batch/rosetta/default.ts-fixture
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Fixture with packages imported, but nothing else
import { Construct } from 'constructs';
import { Stack } from '@aws-cdk/core';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as batch from '@aws-cdk/aws-batch';
import * as ecs from '@aws-cdk/aws-ecs';

class Fixture extends Stack {
constructor(scope: Construct, id: string) {
super(scope, id);

/// here
}
}
Loading

0 comments on commit 645766d

Please sign in to comment.