Skip to content
v2.278.0

S3SourceActionProps Struct ​

Construction properties of the S3SourceAction S3 source Action.

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,
    },
  },
});
python
# source_bucket: s3.Bucket

# later:
# project: codebuild.PipelineProject
key = "some/key.zip"
source_output = codepipeline.Artifact()
source_action = codepipeline_actions.S3SourceAction(
    action_name="S3Source",
    bucket_key=key,
    bucket=source_bucket,
    output=source_output,
    variables_namespace="MyNamespace"
)
codepipeline_actions.CodeBuildAction(
    action_name="CodeBuild",
    project=project,
    input=source_output,
    environment_variables={
        "VERSION_ID": codebuild.BuildEnvironmentVariable(
            value=source_action.variables.version_id
        )
    }
)
java
Bucket sourceBucket;

// later:
PipelineProject project;
String key = "some/key.zip";
Artifact sourceOutput = new Artifact();
S3SourceAction sourceAction = S3SourceAction.Builder.create()
        .actionName("S3Source")
        .bucketKey(key)
        .bucket(sourceBucket)
        .output(sourceOutput)
        .variablesNamespace("MyNamespace")
        .build();
CodeBuildAction.Builder.create()
        .actionName("CodeBuild")
        .project(project)
        .input(sourceOutput)
        .environmentVariables(Map.of(
                "VERSION_ID", BuildEnvironmentVariable.builder()
                        .value(sourceAction.getVariables().getVersionId())
                        .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Bucket sourceBucket;

// later:
PipelineProject project;
var key = "some/key.zip";
var sourceOutput = new Artifact();
var sourceAction = new S3SourceAction(new S3SourceActionProps {
    ActionName = "S3Source",
    BucketKey = key,
    Bucket = sourceBucket,
    Output = sourceOutput,
    VariablesNamespace = "MyNamespace"
});
new CodeBuildAction(new CodeBuildActionProps {
    ActionName = "CodeBuild",
    Project = project,
    Input = sourceOutput,
    EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
        { "VERSION_ID", new BuildEnvironmentVariable {
            Value = sourceAction.Variables.VersionId
        } }
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var sourceBucket Bucket

// later:
var project PipelineProject
key := "some/key.zip"
sourceOutput := codepipeline.NewArtifact()
sourceAction := codepipeline_actions.NewS3SourceAction(&S3SourceActionProps{
	ActionName: jsii.String("S3Source"),
	BucketKey: key,
	Bucket: sourceBucket,
	Output: sourceOutput,
	VariablesNamespace: jsii.String("MyNamespace"),
})
codepipeline_actions.NewCodeBuildAction(&CodeBuildActionProps{
	ActionName: jsii.String("CodeBuild"),
	Project: Project,
	Input: sourceOutput,
	EnvironmentVariables: map[string]BuildEnvironmentVariable{
		"VERSION_ID": &BuildEnvironmentVariable{
			"value": sourceAction.variables.versionId,
		},
	},
})

Properties ​

actionNamestringaction_namestractionNameStringActionNamestringActionName*string required #
The physical, human-readable name of the Action.

Note that Action names must be unique within a single Stage.

bucketIBucketbucketIBucketbucketIBucketBucketIBucketBucketIBucket required #
The Amazon S3 bucket that stores the source code.

If you import an encrypted bucket in your stack, please specify the encryption key at import time by using Bucket.fromBucketAttributes() method.

bucketKeystringbucket_keystrbucketKeyStringBucketKeystringBucketKey*string required #
The key within the S3 bucket that stores the source code.
example
ts
'path/to/file.zip'
outputArtifactoutputArtifactoutputArtifactOutputArtifactOutputArtifact required #
roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole #
The Role in which context's this Action will be executing in.

Default: a new Role will be generated

notes

The Pipeline's Role will assume this Role (the required permissions for that will be granted automatically) right before executing this Action. This Action will be passed into your IAction.bind method in the ActionBindOptions.role property.

runOrderoptionalnumberrun_orderoptionalint | floatrunOrderoptionalNumberRunOrderoptionaldoubleRunOrderoptional*float64 = 1 #
The runOrder property for this Action.

RunOrder determines the relative order in which multiple Actions in the same Stage execute.

triggeroptionalS3TriggertriggeroptionalS3TriggertriggeroptionalS3TriggerTriggeroptionalS3TriggerTriggeroptionalS3Trigger = S3Trigger.POLL #
How should CodePipeline detect source changes for this Action.

Note that if this is S3Trigger.EVENTS, you need to make sure to include the source Bucket in a CloudTrail Trail, as otherwise the CloudWatch Events will not be emitted.

variablesNamespaceoptionalstringvariables_namespaceoptionalstrvariablesNamespaceoptionalStringVariablesNamespaceoptionalstringVariablesNamespaceoptional*string #
The name of the namespace to use for variables emitted by this action.

Default: a name will be generated, based on the stage and action names, if any of the action's variables were referenced - otherwise, no namespace will be set