Skip to content
v2.278.0

NodeLifecycleActionsProperty Struct ​

Custom scripts that run at defined points in a compute node's lifecycle.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_pcs as pcs } from 'aws-cdk-lib';
const nodeLifecycleActionsProperty: pcs.CfnComputeNodeGroup.NodeLifecycleActionsProperty = {
  stages: {
    nodeBootstrapped: [{
      name: 'name',
      scriptSource: {
        scriptLocation: 'scriptLocation',

        // the properties below are optional
        checksum: 'checksum',
        s3VersionId: 's3VersionId',
      },

      // the properties below are optional
      arguments: ['arguments'],
      executionPolicy: 'executionPolicy',
      onError: 'onError',
    }],
    nodeReady: [{
      name: 'name',
      scriptSource: {
        scriptLocation: 'scriptLocation',

        // the properties below are optional
        checksum: 'checksum',
        s3VersionId: 's3VersionId',
      },

      // the properties below are optional
      arguments: ['arguments'],
      executionPolicy: 'executionPolicy',
      onError: 'onError',
    }],
  },

  // the properties below are optional
  scriptCachingPolicy: 'scriptCachingPolicy',
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_pcs as pcs

node_lifecycle_actions_property = pcs.CfnComputeNodeGroup.NodeLifecycleActionsProperty(
    stages=pcs.CfnComputeNodeGroup.NodeLifecycleStagesProperty(
        node_bootstrapped=[pcs.CfnComputeNodeGroup.NodeLifecycleScriptProperty(
            name="name",
            script_source=pcs.CfnComputeNodeGroup.ScriptSourceProperty(
                script_location="scriptLocation",

                # the properties below are optional
                checksum="checksum",
                s3_version_id="s3VersionId"
            ),

            # the properties below are optional
            arguments=["arguments"],
            execution_policy="executionPolicy",
            on_error="onError"
        )],
        node_ready=[pcs.CfnComputeNodeGroup.NodeLifecycleScriptProperty(
            name="name",
            script_source=pcs.CfnComputeNodeGroup.ScriptSourceProperty(
                script_location="scriptLocation",

                # the properties below are optional
                checksum="checksum",
                s3_version_id="s3VersionId"
            ),

            # the properties below are optional
            arguments=["arguments"],
            execution_policy="executionPolicy",
            on_error="onError"
        )]
    ),

    # the properties below are optional
    script_caching_policy="scriptCachingPolicy"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.pcs.*;

NodeLifecycleActionsProperty nodeLifecycleActionsProperty = NodeLifecycleActionsProperty.builder()
        .stages(NodeLifecycleStagesProperty.builder()
                .nodeBootstrapped(List.of(NodeLifecycleScriptProperty.builder()
                        .name("name")
                        .scriptSource(ScriptSourceProperty.builder()
                                .scriptLocation("scriptLocation")

                                // the properties below are optional
                                .checksum("checksum")
                                .s3VersionId("s3VersionId")
                                .build())

                        // the properties below are optional
                        .arguments(List.of("arguments"))
                        .executionPolicy("executionPolicy")
                        .onError("onError")
                        .build()))
                .nodeReady(List.of(NodeLifecycleScriptProperty.builder()
                        .name("name")
                        .scriptSource(ScriptSourceProperty.builder()
                                .scriptLocation("scriptLocation")

                                // the properties below are optional
                                .checksum("checksum")
                                .s3VersionId("s3VersionId")
                                .build())

                        // the properties below are optional
                        .arguments(List.of("arguments"))
                        .executionPolicy("executionPolicy")
                        .onError("onError")
                        .build()))
                .build())

        // the properties below are optional
        .scriptCachingPolicy("scriptCachingPolicy")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.PCS;

var nodeLifecycleActionsProperty = new NodeLifecycleActionsProperty {
    Stages = new NodeLifecycleStagesProperty {
        NodeBootstrapped = new [] { new NodeLifecycleScriptProperty {
            Name = "name",
            ScriptSource = new ScriptSourceProperty {
                ScriptLocation = "scriptLocation",

                // the properties below are optional
                Checksum = "checksum",
                S3VersionId = "s3VersionId"
            },

            // the properties below are optional
            Arguments = new [] { "arguments" },
            ExecutionPolicy = "executionPolicy",
            OnError = "onError"
        } },
        NodeReady = new [] { new NodeLifecycleScriptProperty {
            Name = "name",
            ScriptSource = new ScriptSourceProperty {
                ScriptLocation = "scriptLocation",

                // the properties below are optional
                Checksum = "checksum",
                S3VersionId = "s3VersionId"
            },

            // the properties below are optional
            Arguments = new [] { "arguments" },
            ExecutionPolicy = "executionPolicy",
            OnError = "onError"
        } }
    },

    // the properties below are optional
    ScriptCachingPolicy = "scriptCachingPolicy"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

nodeLifecycleActionsProperty := &NodeLifecycleActionsProperty{
	Stages: &NodeLifecycleStagesProperty{
		NodeBootstrapped: []interface{}{
			&NodeLifecycleScriptProperty{
				Name: jsii.String("name"),
				ScriptSource: &ScriptSourceProperty{
					ScriptLocation: jsii.String("scriptLocation"),

					// the properties below are optional
					Checksum: jsii.String("checksum"),
					S3VersionId: jsii.String("s3VersionId"),
				},

				// the properties below are optional
				Arguments: []*string{
					jsii.String("arguments"),
				},
				ExecutionPolicy: jsii.String("executionPolicy"),
				OnError: jsii.String("onError"),
			},
		},
		NodeReady: []interface{}{
			&NodeLifecycleScriptProperty{
				Name: jsii.String("name"),
				ScriptSource: &ScriptSourceProperty{
					ScriptLocation: jsii.String("scriptLocation"),

					// the properties below are optional
					Checksum: jsii.String("checksum"),
					S3VersionId: jsii.String("s3VersionId"),
				},

				// the properties below are optional
				Arguments: []*string{
					jsii.String("arguments"),
				},
				ExecutionPolicy: jsii.String("executionPolicy"),
				OnError: jsii.String("onError"),
			},
		},
	},

	// the properties below are optional
	ScriptCachingPolicy: jsii.String("scriptCachingPolicy"),
}

Properties ​

scriptCachingPolicyoptionalstringscript_caching_policyoptionalstrscriptCachingPolicyoptionalStringScriptCachingPolicyoptionalstringScriptCachingPolicyoptional*string #
Controls whether lifecycle scripts are downloaded once at first boot (CACHE_ONCE) or re-downloaded on every reboot (REFRESH_ON_REBOOT).

Defaults to CACHE_ONCE.

The ordered scripts to run at each compute node lifecycle stage.