/** * <p> * The user data to make available to the instance. For more information, see <a * href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html">Running Commands on Your Linux Instance * at Launch</a> (Linux) and <a href= * "http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data" * >Adding User Data</a> (Windows). If you are using a command line tool, base64-encoding is performed for you, and * you can load the text from a file. Otherwise, you must provide base64-encoded text. * </p> * * @param userData * The user data to make available to the instance. For more information, see <a * href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html">Running Commands on Your Linux * Instance at Launch</a> (Linux) and <a href= * "http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data" * >Adding User Data</a> (Windows). If you are using a command line tool, base64-encoding is performed for * you, and you can load the text from a file. Otherwise, you must provide base64-encoded text. * @return Returns a reference to this object so that method calls can be chained together. */ public RunInstancesRequest withUserData(String userData) { setUserData(userData); return this; }
req.setUserData(userData);
/** * <p> * The user data to make available to the instance. For more information, see <a * href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html">Running Commands on Your Linux Instance * at Launch</a> (Linux) and <a href= * "https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data" * >Adding User Data</a> (Windows). If you are using a command line tool, base64-encoding is performed for you, and * you can load the text from a file. Otherwise, you must provide base64-encoded text. * </p> * * @param userData * The user data to make available to the instance. For more information, see <a * href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html">Running Commands on Your Linux * Instance at Launch</a> (Linux) and <a href= * "https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data" * >Adding User Data</a> (Windows). If you are using a command line tool, base64-encoding is performed for * you, and you can load the text from a file. Otherwise, you must provide base64-encoded text. * @return Returns a reference to this object so that method calls can be chained together. */ public RunInstancesRequest withUserData(String userData) { setUserData(userData); return this; }
runInstancesRequest.setUserData( encodedUserData );
.withIamInstanceProfile(new IamInstanceProfileSpecification().withName(iamInstanceProfileName)); if (Strings.isNullOrEmpty(this.userData) == false) { request.setUserData(new String(Base64.getEncoder() .encode(userData.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8));
riRequest.setUserData(userDataString); riRequest.setKeyName(keyPair.getKeyName()); diFilters.add(new Filter("key-name").withValues(keyPair.getKeyName()));
riRequest.setUserData(Base64.encodeBase64String(userData.getBytes(StandardCharsets.UTF_8))); riRequest.setKeyName(keyPair.getKeyName()); diFilters.add(new Filter("key-name").withValues(keyPair.getKeyName()));