Skip to content
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(aws-fargate-stepfunctions): new construct #677

Merged
merged 10 commits into from
May 10, 2022
4 changes: 2 additions & 2 deletions DESIGN_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,14 @@ Existing Inconsistencies would not be published, that’s for our internal use
| Name | Type | Description | Notes |
| --- | --- | --- |--- |
| stateMachineProps |[`sfn.StateMachineProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-stepfunctions.StateMachineProps.html)|Optional user provided props to override the default props for `sfn.StateMachine`|
| createCloudWatchAlarms | `boolean`|Whether to create recommended CloudWatch alarms.|
| createCloudWatchAlarms? | `boolean`|Whether to create recommended CloudWatch alarms.|
mickychetta marked this conversation as resolved.
Show resolved Hide resolved

**Required Construct Properties**

| Name | Type | Description | Notes |
| --- | --- | --- |--- |
| stateMachine| [`sfn.StateMachine`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-stepfunctions.StateMachine.html)|Returns an instance of `sfn.StateMachine` created by the construct.|
| stateMachineLoggingGroup|[`logs.ILogGroup`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.ILogGroup.html)|Returns an instance of the `logs.ILogGroup` created by the construct for StateMachine.|
| stateMachineLogGroup|[`logs.ILogGroup`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.ILogGroup.html)|Returns an instance of the `logs.ILogGroup` created by the construct for StateMachine.|
| cloudwatchAlarms? | [`cloudwatch.Alarm[]`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudwatch.Alarm.html)|Returns a list of `cloudwatch.Alarm` created by the construct.|

## VPC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
|![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-fargate-stepfunctions`|
|![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.fargatestepfunctions`|

This AWS Solutions Construct implements an AWS Fargate service that can write/read to an AWS Step Function
This AWS Solutions Construct implements an AWS Fargate service that can execute an AWS Step Functions state machine

Here is a minimal deployable pattern definition:

Expand Down Expand Up @@ -100,10 +100,9 @@ new FargateToStepfunctions(this, "test-construct", new FargateToStepfunctionsPro
|existingFargateServiceObject? | [`ecs.FargateService`](https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-ecs.FargateService.html) | A Fargate Service already instantiated (probably by another Solutions Construct). If this is specified, then no props defining a new service can be provided, including: ecrImageVersion, containerDefinitionProps, fargateTaskDefinitionProps, ecrRepositoryArn, fargateServiceProps, clusterProps |
|existingContainerDefinitionObject? | [`ecs.ContainerDefinition`](https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-ecs.ContainerDefinition.html) | A container definition already instantiated as part of a Fargate service. This must be the container in the existingFargateServiceObject |
|stateMachineProps|[`sfn.StateMachineProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-stepfunctions.StateMachineProps.html)|User provided props to override the default props for sfn.StateMachine.|
| createCloudWatchAlarms | `boolean`|Whether to create recommended CloudWatch alarms.|
| createCloudWatchAlarms? | `boolean`|Whether to create recommended CloudWatch alarms.|
|logGroupProps?|[`logs.LogGroupProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.LogGroupProps.html)|Optional user provided props to override the default props for for the CloudWatchLogs LogGroup.|
|stateMachineEnvironmentVariableName?|`string`|Optional name for the Step Function environment variable set for the container.|
|stateMachineArnEnvironmentVariableName?|`string`|Optional name for the Step Function ARN environment variable set for the container.|
|stateMachineEnvironmentVariableName?|`string`|Optional name for the container environment variable containing the state machine ARN.|

## Pattern Properties

Expand All @@ -125,15 +124,15 @@ Out of the box implementation of the Construct without any override will set the
* Uses the existing service if provided
* Creates a new service if none provided.
* Service will run in isolated subnets if available, then private subnets if available and finally public subnets
* Adds environment variables to the container with the ARN and Name of the State Machine
* Add permissions to the container IAM role allowing it to read/write to the State Machine
* Adds an environment variable to the container containing the ARN of the state machine
* Default name is `STATE_MACHINE_ARN`
* Add permissions to the container IAM role allowing it to start the execution of a state machine

### AWS Step Functions
* Sets up an AWS Step Function
* Uses an existing step function if one is provided, otherwise creates a new one
* Sets up an AWS Step Functions state machine
* Uses an existing state machine if one is provided, otherwise creates a new one
* Adds an Interface Endpoint to the VPC for Step Functions (the service by default runs in Isolated or Private subnets)
mickychetta marked this conversation as resolved.
Show resolved Hide resolved
* Enables CloudWatch logging
* Deploys best practices of CloudWatch Alarms

## Architecture
![Architecture Diagram](architecture.png)
Expand Down