aws-s3-step-function - AWS Solutions Constructs

aws-s3-step-function

All classes are under active development and subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.

Language Package
Python
aws_solutions_constructs.aws_s3_step_function
Typescript
@aws-solutions-constructs/aws-s3-step-function
Java
software.amazon.awsconstructs.services.s3stepfunction

This AWS Solutions Constructs pattern implements an Amazon S3 bucket connected to an AWS Step Function.

Here is a minimal deployable pattern definition:

const { S3ToStepFunction, S3ToStepFunctionProps } = require('@aws-solutions-constructs/aws-s3-step-function'); const startState = new stepfunctions.Pass(stack, 'StartState'); const props: S3ToStepFunctionProps = { stateMachineProps: { definition: startState } }; new S3ToStepFunction(stack, 'test-s3-step-function-stack', props);

Initializer

new S3ToStepFunction(scope: Construct, id: string, props: S3ToStepFunctionProps);

Parameters

Pattern Construct Props

Name Type Description
existingBucketObj? s3.Bucket An optional, existing bucket to be used instead of the default bucket. If an existing bucket is provided, the bucketProps property will be ignored.
bucketProps? s3.BucketProps Optional user-provided properties to override the default properties for the bucket. Ignored if an existingBucketObj is provided.
stateMachineProps sfn.StateMachineProps Optional user provided props to override the default props for sfn.StateMachine
eventRuleProps? events.RuleProps Optional user provided eventRuleProps to override the defaults
deployCloudTrail? boolean Whether to deploy a Trail in AWS CloudTrail to log API events in Amazon S3

Pattern Properties

Name Type Description
cloudtrail? cloudtrail.Trail Returns an instance of the Cloudtrail trail created by the pattern.
cloudtrailBucket? s3.Bucket Returns an instance of the bucket created by the pattern for storing Cloudtrail trail data.
cloudtrailLoggingBucket? s3.Bucket Returns an instance of the logging bucket created by the pattern for the primary bucket used by the Cloudtrail trail.
cloudwatchAlarms cloudwatch.Alarm[] Returns a list of one or more CloudWatch alarms created by the pattern.
s3Bucket s3.Bucket Returns an instance of the S3 bucket created by the pattern.
s3LoggingBucket? s3.Bucket Returns an instance of the logging bucket created by the pattern for the S3 bucket.
stateMachine sfn.StateMachine Returns an instance of the state machine created by the pattern.
stateMachineLogGroup logs.LogGroup Returns an instance of the log group created by the pattern for the state machine.

Default settings

Out-of-the-box implementation of this pattern without any overrides will set the following defaults:

Amazon S3 Bucket

  • Configure Access logging for S3 Bucket

  • Enable server-side encryption for S3 Bucket using AWS managed KMS Key

  • Turn on the versioning for S3 Bucket

  • Don't allow public access for S3 Bucket

  • Retain the S3 Bucket when deleting the CloudFormation stack

  • Enforce encryption of data in transit

AWS CloudTrail

  • Configure a Trail in AWS CloudTrail to log API events in Amazon S3 related to the Bucket created by the Construct

Amazon CloudWatch Events Rule

  • Grant least privilege permissions to CloudWatch Events to trigger the Lambda Function

AWS Step Function

  • Enable CloudWatch logging for API Gateway

  • Deploy best practices CloudWatch Alarms for the Step Function

Architecture