Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
comcalvi committed Jun 26, 2023
1 parent 7f7a7b1 commit c0ac3d6
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 15 deletions.
23 changes: 23 additions & 0 deletions packages/@aws-cdk/aws-batch-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,29 @@ jobDefn.container.addVolume(batch.EcsVolume.efs({
}));
```

### Secrets

You can expose SecretsManager Secret ARNs to your container as environment variables.
The following example defines the `MY_SECRET_ENV_VAR` environment variable that contains the
ARN of the Secret defined by `mySecret`:

```ts
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';

declare const mySecret: efs.ISecret;

const jobDefn = new batch.EcsJobDefinition(this, 'JobDefn', {
container: new batch.EcsEc2ContainerDefinition(this, 'containerDefn', {
image: ecs.ContainerImage.fromRegistry('public.ecr.aws/amazonlinux/amazonlinux:latest'),
memory: cdk.Size.mebibytes(2048),
cpu: 256,
secrets: {
MY_SECRET_ENV_VAR: mySecret,
}
}),
});
```

### Running Kubernetes Workflows

Batch also supports running workflows on EKS. The following example creates a `JobDefinition` that runs on EKS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/8be63f599ffbd8a18c7e43d09d93160a5389dd885974db646e3120f05d001ff9.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/dbfcc646c8225dd32d69798b87a8a94086dd89a2b3137bdf4e0ec96d79cdd4cb.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "32.0.0",
"files": {
"8be63f599ffbd8a18c7e43d09d93160a5389dd885974db646e3120f05d001ff9": {
"dbfcc646c8225dd32d69798b87a8a94086dd89a2b3137bdf4e0ec96d79cdd4cb": {
"source": {
"path": "stack.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "8be63f599ffbd8a18c7e43d09d93160a5389dd885974db646e3120f05d001ff9.json",
"objectKey": "dbfcc646c8225dd32d69798b87a8a94086dd89a2b3137bdf4e0ec96d79cdd4cb.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@
],
"Secrets": [
{
"Name": "mySecretEnvVar",
"Name": "MY_SECRET_ENV_VAR",
"ValueFrom": {
"Ref": "mySecretE4D0A59C"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,8 @@
}
},
"constructInfo": {
"fqn": "@aws-cdk/aws-batch-alpha.EcsEc2ContainerDefinition",
"version": "0.0.0"
"fqn": "constructs.Construct",
"version": "10.2.52"
}
},
"ECSJobDefn": {
Expand Down Expand Up @@ -894,7 +894,7 @@
],
"secrets": [
{
"name": "mySecretEnvVar",
"name": "MY_SECRET_ENV_VAR",
"valueFrom": {
"Ref": "mySecretE4D0A59C"
}
Expand Down Expand Up @@ -948,7 +948,7 @@
}
},
"constructInfo": {
"fqn": "@aws-cdk/aws-batch-alpha.EcsJobDefinition",
"fqn": "aws-cdk-lib.Resource",
"version": "0.0.0"
}
},
Expand Down Expand Up @@ -1001,8 +1001,8 @@
}
},
"constructInfo": {
"fqn": "@aws-cdk/aws-batch-alpha.EcsFargateContainerDefinition",
"version": "0.0.0"
"fqn": "constructs.Construct",
"version": "10.2.52"
}
},
"ECSFargateJobDefn": {
Expand Down Expand Up @@ -1086,7 +1086,7 @@
}
},
"constructInfo": {
"fqn": "@aws-cdk/aws-batch-alpha.EcsJobDefinition",
"fqn": "aws-cdk-lib.Resource",
"version": "0.0.0"
}
},
Expand Down Expand Up @@ -1235,8 +1235,8 @@
}
},
"constructInfo": {
"fqn": "@aws-cdk/aws-batch-alpha.EcsEc2ContainerDefinition",
"version": "0.0.0"
"fqn": "constructs.Construct",
"version": "10.2.52"
}
},
"ECSDockerJobDefn": {
Expand Down Expand Up @@ -1287,7 +1287,7 @@
}
},
"constructInfo": {
"fqn": "@aws-cdk/aws-batch-alpha.EcsJobDefinition",
"fqn": "aws-cdk-lib.Resource",
"version": "0.0.0"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ new batch.EcsJobDefinition(stack, 'ECSJobDefn', {
softLimit: 10,
}],
secrets: {
mySecretEnvVar: new Secret(stack, 'mySecret'),
MY_SECRET_ENV_VAR: new Secret(stack, 'mySecret'),
},
}),
});
Expand Down

0 comments on commit c0ac3d6

Please sign in to comment.