Class InitGroup

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.ec2.InitElement
software.amazon.awscdk.services.ec2.InitGroup
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.96.0 (build 921e240)", date="2024-04-10T22:22:26.971Z") @Stability(Stable) public class InitGroup extends InitElement
Create Linux/UNIX groups and assign group IDs.

Not supported for Windows systems.

Example:

 Vpc vpc;
 InstanceType instanceType;
 IMachineImage machineImage;
 Instance.Builder.create(this, "Instance")
         .vpc(vpc)
         .instanceType(instanceType)
         .machineImage(machineImage)
         // Showing the most complex setup, if you have simpler requirements
         // you can use `CloudFormationInit.fromElements()`.
         .init(CloudFormationInit.fromConfigSets(ConfigSetProps.builder()
                 .configSets(Map.of(
                         // Applies the configs below in this order
                         "default", List.of("yumPreinstall", "config")))
                 .configs(Map.of(
                         "yumPreinstall", new InitConfig(List.of(InitPackage.yum("git"))),
                         "config", new InitConfig(List.of(InitFile.fromObject("/etc/stack.json", Map.of(
                                 "stackId", Stack.of(this).getStackId(),
                                 "stackName", Stack.of(this).getStackName(),
                                 "region", Stack.of(this).getRegion())), InitGroup.fromName("my-group"), InitUser.fromName("my-user"), InitPackage.rpm("http://mirrors.ukfast.co.uk/sites/dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/r/rubygem-git-1.5.0-2.el8.noarch.rpm")))))
                 .build()))
         .initOptions(ApplyCloudFormationInitOptions.builder()
                 // Optional, which configsets to activate (['default'] by default)
                 .configSets(List.of("default"))
                 // Optional, how long the installation is expected to take (5 minutes by default)
                 .timeout(Duration.minutes(30))
                 // Optional, whether to include the --url argument when running cfn-init and cfn-signal commands (false by default)
                 .includeUrl(true)
                 // Optional, whether to include the --role argument when running cfn-init and cfn-signal commands (false by default)
                 .includeRole(true)
                 .build())
         .build();
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    InitGroup(String groupName)
     
    protected
    InitGroup(String groupName, Number groupId)
     
    protected
    InitGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    InitGroup(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static InitGroup
    fromName(String groupName)
    Create a group from its name, and optionally, group id.
    static InitGroup
    fromName(String groupName, Number groupId)
    Create a group from its name, and optionally, group id.
    Returns the init element type for this element.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • InitGroup

      protected InitGroup(software.amazon.jsii.JsiiObjectRef objRef)
    • InitGroup

      protected InitGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • InitGroup

      @Stability(Stable) protected InitGroup(@NotNull String groupName, @Nullable Number groupId)
      Parameters:
      groupName - This parameter is required.
      groupId -
    • InitGroup

      @Stability(Stable) protected InitGroup(@NotNull String groupName)
      Parameters:
      groupName - This parameter is required.
  • Method Details

    • fromName

      @Stability(Stable) @NotNull public static InitGroup fromName(@NotNull String groupName, @Nullable Number groupId)
      Create a group from its name, and optionally, group id.

      Parameters:
      groupName - This parameter is required.
      groupId -
    • fromName

      @Stability(Stable) @NotNull public static InitGroup fromName(@NotNull String groupName)
      Create a group from its name, and optionally, group id.

      Parameters:
      groupName - This parameter is required.
    • getElementType

      @Stability(Stable) @NotNull public String getElementType()
      Returns the init element type for this element.
      Specified by:
      getElementType in class InitElement