S3DeployAction Class
Deploys the sourceArtifact to Amazon S3.
Example
ts
declare const sourceArtifact: codepipeline.Artifact;
declare const outputArtifact: codepipeline.Artifact;
const commandsAction = new codepipeline_actions.CommandsAction({
actionName: 'Commands',
commands: [
'export MY_OUTPUT=my-key',
],
input: sourceArtifact,
output: outputArtifact,
outputVariables: ['MY_OUTPUT', 'CODEBUILD_BUILD_ID'], // CODEBUILD_BUILD_ID is a variable defined by CodeBuild
});
// Deploy action
const deployAction = new codepipeline_actions.S3DeployAction({
actionName: 'DeployAction',
extract: true,
input: outputArtifact,
bucket: new s3.Bucket(this, 'DeployBucket'),
objectKey: commandsAction.variable('MY_OUTPUT'), // the variable emitted by the Commands action
});
python
# source_artifact: codepipeline.Artifact
# output_artifact: codepipeline.Artifact
commands_action = codepipeline_actions.CommandsAction(
action_name="Commands",
commands=["export MY_OUTPUT=my-key"
],
input=source_artifact,
output=output_artifact,
output_variables=["MY_OUTPUT", "CODEBUILD_BUILD_ID"]
)
# Deploy action
deploy_action = codepipeline_actions.S3DeployAction(
action_name="DeployAction",
extract=True,
input=output_artifact,
bucket=s3.Bucket(self, "DeployBucket"),
object_key=commands_action.variable("MY_OUTPUT")
)
java
Artifact sourceArtifact;
Artifact outputArtifact;
CommandsAction commandsAction = CommandsAction.Builder.create()
.actionName("Commands")
.commands(List.of("export MY_OUTPUT=my-key"))
.input(sourceArtifact)
.output(outputArtifact)
.outputVariables(List.of("MY_OUTPUT", "CODEBUILD_BUILD_ID"))
.build();
// Deploy action
S3DeployAction deployAction = S3DeployAction.Builder.create()
.actionName("DeployAction")
.extract(true)
.input(outputArtifact)
.bucket(new Bucket(this, "DeployBucket"))
.objectKey(commandsAction.variable("MY_OUTPUT"))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Artifact sourceArtifact;
Artifact outputArtifact;
var commandsAction = new CommandsAction(new CommandsActionProps {
ActionName = "Commands",
Commands = new [] { "export MY_OUTPUT=my-key" },
Input = sourceArtifact,
Output = outputArtifact,
OutputVariables = new [] { "MY_OUTPUT", "CODEBUILD_BUILD_ID" }
});
// Deploy action
var deployAction = new S3DeployAction(new S3DeployActionProps {
ActionName = "DeployAction",
Extract = true,
Input = outputArtifact,
Bucket = new Bucket(this, "DeployBucket"),
ObjectKey = commandsAction.Variable("MY_OUTPUT")
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var sourceArtifact Artifact
var outputArtifact Artifact
commandsAction := codepipeline_actions.NewCommandsAction(&CommandsActionProps{
ActionName: jsii.String("Commands"),
Commands: []*string{
jsii.String("export MY_OUTPUT=my-key"),
},
Input: sourceArtifact,
Output: outputArtifact,
OutputVariables: []*string{
jsii.String("MY_OUTPUT"),
jsii.String("CODEBUILD_BUILD_ID"),
},
})
// Deploy action
deployAction := codepipeline_actions.NewS3DeployAction(&S3DeployActionProps{
ActionName: jsii.String("DeployAction"),
Extract: jsii.Boolean(true),
Input: outputArtifact,
Bucket: s3.NewBucket(this, jsii.String("DeployBucket")),
ObjectKey: commandsAction.Variable(jsii.String("MY_OUTPUT")),
})
Initializer
ts
new S3DeployAction(props: S3DeployActionProps)
python
S3DeployAction(props: S3DeployActionProps)
java
new S3DeployAction(S3DeployActionProps props)
csharp
new S3DeployAction(S3DeployActionProps props)
go
NewS3DeployAction(Props S3DeployActionProps)
Properties
actionPropertiesActionPropertiesaction_propertiesActionPropertiesactionPropertiesActionPropertiesActionPropertiesActionPropertiesActionPropertiesActionPropertiesrequired#The simple properties of the Action, like its Owner, name, etc.
Note that this accessor will be called before the bind callback.
Methods
bind(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfigdef bind(self, scope: Construct, stage: IStage, options: ActionBindOptions) -> ActionConfigpublic ActionConfig bind(Construct scope, IStage stage, ActionBindOptions options)public ActionConfig Bind(Construct scope, IStage stage, ActionBindOptions options)func 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): Ruledef on_state_change(self, name: str, target: typing.Optional[IRuleTarget] = None, options: typing.Optional[RuleProps] = None) -> Rulepublic Rule onStateChange(String name, IRuleTarget target, RuleProps options)public Rule OnStateChange(string name, IRuleTarget? target = null, RuleProps? options = null)func OnStateChange(Name *string, Target IRuleTarget, Options RuleProps) Rule#Creates an Event that will be triggered whenever the state of this Action changes.