Class UserData
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.ec2.UserData
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
- Direct Known Subclasses:
MultipartUserData
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:39.546Z")
@Stability(Stable)
public abstract class UserData
extends software.amazon.jsii.JsiiObject
Instance User Data.
Example:
MultipartUserData multipartUserData = new MultipartUserData();
UserData commandsUserData = UserData.forLinux();
multipartUserData.addUserDataPart(commandsUserData, MultipartBody.SHELL_SCRIPT, true);
// Adding commands to the multipartUserData adds them to commandsUserData, and vice-versa.
multipartUserData.addCommands("touch /root/multi.txt");
commandsUserData.addCommands("touch /root/userdata.txt");
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddCommands(@NotNull String... commands) Add one or more commands to the user data.abstract voidAdds commands to execute a file.abstract voidaddOnExitCommands(@NotNull String... commands) Add one or more commands to the user data that will run when the script exits.abstract StringAdds commands to download a file from S3.abstract voidaddSignalOnExitCommand(Resource resource) Adds a command which will send a cfn-signal when the user data script ends.static UserDataCreate a userdata object with custom content.static UserDataforLinux()Create a userdata object for Linux hosts.static UserDataforLinux(LinuxUserDataOptions options) Create a userdata object for Linux hosts.static UserDatastatic UserDataCreate a userdata object for Windows hosts.abstract Stringrender()Render the UserData for use in a construct.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
UserData
protected UserData(software.amazon.jsii.JsiiObjectRef objRef) -
UserData
protected UserData(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
UserData
@Stability(Stable) protected UserData()
-
-
Method Details
-
custom
Create a userdata object with custom content.- Parameters:
content- This parameter is required.
-
forLinux
Create a userdata object for Linux hosts.- Parameters:
options-
-
forLinux
Create a userdata object for Linux hosts. -
forOperatingSystem
@Stability(Stable) @NotNull public static UserData forOperatingSystem(@NotNull OperatingSystemType os) - Parameters:
os- This parameter is required.
-
forWindows
Create a userdata object for Windows hosts. -
addCommands
Add one or more commands to the user data.- Parameters:
commands- This parameter is required.
-
addExecuteFileCommand
Adds commands to execute a file.- Parameters:
params- This parameter is required.
-
addOnExitCommands
Add one or more commands to the user data that will run when the script exits.- Parameters:
commands- This parameter is required.
-
addS3DownloadCommand
@Stability(Stable) @NotNull public abstract String addS3DownloadCommand(@NotNull S3DownloadOptions params) Adds commands to download a file from S3.- Parameters:
params- This parameter is required.- Returns:
- : The local path that the file will be downloaded to
-
addSignalOnExitCommand
Adds a command which will send a cfn-signal when the user data script ends.- Parameters:
resource- This parameter is required.
-
render
Render the UserData for use in a construct.
-