# CodeDeployServerDeployAction

Extends: [Action](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Action.html) › [Action](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline_actions.Action.html) › CodeDeployServerDeployAction
Implements: [IAction](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.IAction.html)

- Source: [`aws-codepipeline-actions/lib/codedeploy/server-deploy-action.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codedeploy/server-deploy-action.ts#L23)

## Example

TypeScript:

```ts
const pipeline = new codepipeline.Pipeline(this, 'MyPipeline', {
  pipelineName: 'MyPipeline',
});

// add the source and build Stages to the Pipeline...
const buildOutput = new codepipeline.Artifact();
declare const deploymentGroup: codedeploy.ServerDeploymentGroup;
const deployAction = new codepipeline_actions.CodeDeployServerDeployAction({
  actionName: 'CodeDeploy',
  input: buildOutput,
  deploymentGroup,
});
pipeline.addStage({
  stageName: 'Deploy',
  actions: [deployAction],
});
```

Python:

```python
# deployment_group: codedeploy.ServerDeploymentGroup
pipeline = codepipeline.Pipeline(self, "MyPipeline",
    pipeline_name="MyPipeline"
)

# add the source and build Stages to the Pipeline...
build_output = codepipeline.Artifact()
deploy_action = codepipeline_actions.CodeDeployServerDeployAction(
    action_name="CodeDeploy",
    input=build_output,
    deployment_group=deployment_group
)
pipeline.add_stage(
    stage_name="Deploy",
    actions=[deploy_action]
)
```

Java:

```java
ServerDeploymentGroup deploymentGroup;
Pipeline pipeline = Pipeline.Builder.create(this, "MyPipeline")
        .pipelineName("MyPipeline")
        .build();

// add the source and build Stages to the Pipeline...
Artifact buildOutput = new Artifact();
CodeDeployServerDeployAction deployAction = CodeDeployServerDeployAction.Builder.create()
        .actionName("CodeDeploy")
        .input(buildOutput)
        .deploymentGroup(deploymentGroup)
        .build();
pipeline.addStage(StageOptions.builder()
        .stageName("Deploy")
        .actions(List.of(deployAction))
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
ServerDeploymentGroup deploymentGroup;
var pipeline = new Pipeline(this, "MyPipeline", new PipelineProps {
    PipelineName = "MyPipeline"
});

// add the source and build Stages to the Pipeline...
var buildOutput = new Artifact();
var deployAction = new CodeDeployServerDeployAction(new CodeDeployServerDeployActionProps {
    ActionName = "CodeDeploy",
    Input = buildOutput,
    DeploymentGroup = deploymentGroup
});
pipeline.AddStage(new StageOptions {
    StageName = "Deploy",
    Actions = new [] { deployAction }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var deploymentGroup ServerDeploymentGroup
pipeline := codepipeline.NewPipeline(this, jsii.String("MyPipeline"), &PipelineProps{
	PipelineName: jsii.String("MyPipeline"),
})

// add the source and build Stages to the Pipeline...
buildOutput := codepipeline.NewArtifact()
deployAction := codepipeline_actions.NewCodeDeployServerDeployAction(&CodeDeployServerDeployActionProps{
	ActionName: jsii.String("CodeDeploy"),
	Input: buildOutput,
	DeploymentGroup: DeploymentGroup,
})
pipeline.AddStage(&StageOptions{
	StageName: jsii.String("Deploy"),
	Actions: []IAction{
		deployAction,
	},
})
```

## Initializer

TypeScript:

```ts
new CodeDeployServerDeployAction(props: CodeDeployServerDeployActionProps)
```

Python:

```python
CodeDeployServerDeployAction(props: CodeDeployServerDeployActionProps)
```

Java:

```java
new CodeDeployServerDeployAction(CodeDeployServerDeployActionProps props)
```

C# / .NET:

```csharp
new CodeDeployServerDeployAction(CodeDeployServerDeployActionProps props)
```

Golang:

```go
NewCodeDeployServerDeployAction(Props CodeDeployServerDeployActionProps)
```

## Properties

- `actionProperties`: [ActionProperties](https://docs.aws.amazon.com/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.

## 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.
