ServerDeploymentGroup
- class aws_cdk.aws_codedeploy.ServerDeploymentGroup(scope, id, *, alarms=None, application=None, auto_rollback=None, auto_scaling_groups=None, deployment_config=None, deployment_group_name=None, ec2_instance_tags=None, ignore_alarm_configuration=None, ignore_poll_alarms_failure=None, install_agent=None, load_balancer=None, load_balancers=None, on_premise_instance_tags=None, role=None, termination_hook=None)
Bases:
Resource
A CodeDeploy Deployment Group that deploys to EC2/on-premise instances.
- Resource:
AWS::CodeDeploy::DeploymentGroup
- ExampleMetadata:
infused
Example:
# alb: elbv2.ApplicationLoadBalancer listener = alb.add_listener("Listener", port=80) target_group = listener.add_targets("Fleet", port=80) deployment_group = codedeploy.ServerDeploymentGroup(self, "DeploymentGroup", load_balancer=codedeploy.LoadBalancer.application(target_group) )
- Parameters:
scope (
Construct
) –id (
str
) –alarms (
Optional
[Sequence
[IAlarm
]]) – The CloudWatch alarms associated with this Deployment Group. CodeDeploy will stop (and optionally roll back) a deployment if during it any of the alarms trigger. Alarms can also be added after the Deployment Group is created using the#addAlarm
method. Default: []application (
Optional
[IServerApplication
]) – The CodeDeploy EC2/on-premise Application this Deployment Group belongs to. Default: - A new Application will be created.auto_rollback (
Union
[AutoRollbackConfig
,Dict
[str
,Any
],None
]) – The auto-rollback configuration for this Deployment Group. Default: - default AutoRollbackConfig.auto_scaling_groups (
Optional
[Sequence
[IAutoScalingGroup
]]) – The auto-scaling groups belonging to this Deployment Group. Auto-scaling groups can also be added after the Deployment Group is created using the#addAutoScalingGroup
method. [disable-awslint:ref-via-interface] is needed because we update userdata for ASGs to install the codedeploy agent. Default: []deployment_config (
Optional
[IServerDeploymentConfig
]) – The EC2/on-premise Deployment Configuration to use for this Deployment Group. Default: ServerDeploymentConfig#OneAtATimedeployment_group_name (
Optional
[str
]) – The physical, human-readable name of the CodeDeploy Deployment Group. Default: - An auto-generated name will be used.ec2_instance_tags (
Optional
[InstanceTagSet
]) – All EC2 instances matching the given set of tags when a deployment occurs will be added to this Deployment Group. Default: - No additional EC2 instances will be added to the Deployment Group.ignore_alarm_configuration (
Optional
[bool
]) – Whether to skip the step of checking CloudWatch alarms during the deployment process. Default: - falseignore_poll_alarms_failure (
Optional
[bool
]) – Whether to continue a deployment even if fetching the alarm status from CloudWatch failed. Default: falseinstall_agent (
Optional
[bool
]) – If you’ve provided any auto-scaling groups with the#autoScalingGroups
property, you can set this property to add User Data that installs the CodeDeploy agent on the instances. Default: trueload_balancer (
Optional
[LoadBalancer
]) – (deprecated) The load balancer to place in front of this Deployment Group. Can be created from either a classic Elastic Load Balancer, or an Application Load Balancer / Network Load Balancer Target Group. Default: - Deployment Group will not have a load balancer defined.load_balancers (
Optional
[Sequence
[LoadBalancer
]]) – CodeDeploy supports the deployment to multiple load balancers. Specify either multiple Classic Load Balancers, or Application Load Balancers / Network Load Balancers Target Groups. Default: - Deployment Group will not have load balancers defined.on_premise_instance_tags (
Optional
[InstanceTagSet
]) – All on-premise instances matching the given set of tags when a deployment occurs will be added to this Deployment Group. Default: - No additional on-premise instances will be added to the Deployment Group.role (
Optional
[IRole
]) – The service Role of this Deployment Group. Default: - A new Role will be created.termination_hook (
Optional
[bool
]) – Indicates whether the deployment group was configured to have CodeDeploy install a termination hook into an Auto Scaling group. Default: - false
Methods
- add_alarm(alarm)
Associates an additional alarm with this Deployment Group.
- Parameters:
alarm (
IAlarm
) – the alarm to associate with this Deployment Group.- Return type:
None
- add_auto_scaling_group(asg)
Adds an additional auto-scaling group to this Deployment Group.
- Parameters:
asg (
AutoScalingGroup
) – the auto-scaling group to add to this Deployment Group. [disable-awslint:ref-via-interface] is needed in order to install the code deploy agent by updating the ASGs user data.- Return type:
None
- apply_removal_policy(policy)
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
RemovalPolicy
) –- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- application
- auto_scaling_groups
- deployment_config
- deployment_group_arn
The ARN of the Deployment Group.
- deployment_group_name
The name of the Deployment Group.
- env
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
- node
The tree node.
- role
The service Role of this Deployment Group.
- stack
The stack in which this resource is defined.
Static Methods
- classmethod from_server_deployment_group_attributes(scope, id, *, application, deployment_group_name, deployment_config=None)
Import an EC2/on-premise Deployment Group defined either outside the CDK app, or in a different region.
- Parameters:
scope (
Construct
) – the parent Construct for this new Construct.id (
str
) – the logical ID of this new Construct.application (
IServerApplication
) – The reference to the CodeDeploy EC2/on-premise Application that this Deployment Group belongs to.deployment_group_name (
str
) – The physical, human-readable name of the CodeDeploy EC2/on-premise Deployment Group that we are referencing.deployment_config (
Optional
[IServerDeploymentConfig
]) – The Deployment Configuration this Deployment Group uses. Default: ServerDeploymentConfig#OneAtATime
- Return type:
- Returns:
a Construct representing a reference to an existing Deployment Group
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
- classmethod is_owned_resource(construct)
Returns true if the construct was created by CDK, and false otherwise.
- Parameters:
construct (
IConstruct
) –- Return type:
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters:
construct (
IConstruct
) –- Return type:
bool