Class UserData
Instance User Data.
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class UserData : DeputyBase
Syntax (vb)
Public MustInherit Class UserData
Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
var multipartUserData = new MultipartUserData();
var 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");
Synopsis
Constructors
UserData() | |
UserData(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
UserData(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Methods
AddCommands(String[]) | Add one or more commands to the user data. |
AddExecuteFileCommand(IExecuteFileOptions) | Adds commands to execute a file. |
AddOnExitCommands(String[]) | Add one or more commands to the user data that will run when the script exits. |
AddS3DownloadCommand(IS3DownloadOptions) | Adds commands to download a file from S3. |
AddSignalOnExitCommand(Resource) | Adds a command which will send a cfn-signal when the user data script ends. |
Custom(String) | Create a userdata object with custom content. |
ForLinux(ILinuxUserDataOptions) | Create a userdata object for Linux hosts. |
ForOperatingSystem(OperatingSystemType) | |
ForWindows(IWindowsUserDataOptions) | Create a userdata object for Windows hosts. |
Render() | Render the UserData for use in a construct. |
Constructors
UserData()
protected UserData()
UserData(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected UserData(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
UserData(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected UserData(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Methods
AddCommands(String[])
Add one or more commands to the user data.
public abstract void AddCommands(params string[] commands)
Parameters
- commands System.String[]
AddExecuteFileCommand(IExecuteFileOptions)
Adds commands to execute a file.
public abstract void AddExecuteFileCommand(IExecuteFileOptions params)
Parameters
- params IExecuteFileOptions
AddOnExitCommands(String[])
Add one or more commands to the user data that will run when the script exits.
public abstract void AddOnExitCommands(params string[] commands)
Parameters
- commands System.String[]
AddS3DownloadCommand(IS3DownloadOptions)
Adds commands to download a file from S3.
public abstract string AddS3DownloadCommand(IS3DownloadOptions params)
Parameters
- params IS3DownloadOptions
Returns
System.String
: The local path that the file will be downloaded to
AddSignalOnExitCommand(Resource)
Adds a command which will send a cfn-signal when the user data script ends.
public abstract void AddSignalOnExitCommand(Resource resource)
Parameters
- resource Resource
Custom(String)
Create a userdata object with custom content.
public static UserData Custom(string content)
Parameters
- content System.String
Returns
ForLinux(ILinuxUserDataOptions)
Create a userdata object for Linux hosts.
public static UserData ForLinux(ILinuxUserDataOptions options = null)
Parameters
- options ILinuxUserDataOptions
Returns
ForOperatingSystem(OperatingSystemType)
public static UserData ForOperatingSystem(OperatingSystemType os)
Parameters
Returns
ForWindows(IWindowsUserDataOptions)
Create a userdata object for Windows hosts.
public static UserData ForWindows(IWindowsUserDataOptions options = null)
Parameters
- options IWindowsUserDataOptions
Returns
Render()
Render the UserData for use in a construct.
public abstract string Render()
Returns
System.String