# S3SourceAction

Source that is provided by a specific Amazon S3 object.

Will trigger the pipeline as soon as the S3 object changes, but only if there is
a CloudTrail Trail in the account that captures the S3 event.

Extends: Action › Action › S3SourceAction
Implements: IAction

- Source: [`aws-codepipeline-actions/lib/s3/source-action.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-codepipeline-actions/lib/s3/source-action.ts#L87)

## Example

```ts
const key = 'some/key.zip';
declare const sourceBucket: s3.Bucket;
const sourceOutput = new codepipeline.Artifact();
const sourceAction = new codepipeline_actions.S3SourceAction({
  actionName: 'S3Source',
  bucketKey: key,
  bucket: sourceBucket,
  output: sourceOutput,
  variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you
});

// later:
declare const project: codebuild.PipelineProject;
new codepipeline_actions.CodeBuildAction({
  actionName: 'CodeBuild',
  project,
  input: sourceOutput,
  environmentVariables: {
    VERSION_ID: {
      value: sourceAction.variables.versionId,
    },
  },
});
```

## Initializer

```ts
new S3SourceAction(props: S3SourceActionProps)
```

## Properties

- `actionProperties`: [ActionProperties](/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.ActionProperties.html) — The simple properties of the Action, like its Owner, name, etc.

  Note that this accessor will be called before the `bind` callback.

- `variables`: [S3SourceVariables](/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline_actions.S3SourceVariables.html) — The variables emitted by this action.

## Methods

- `bind(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig` — The callback invoked when this Action is added to a Pipeline.

- `onStateChange(name: string, target?: IRuleTarget, options?: RuleProps): Rule` — Creates an Event that will be triggered whenever the state of this Action changes.
