user

You can use the users key to create Linux/UNIX users on the EC2 instance. The user method maps to the AWS::CloudFormation::Init users section.

Example

user("myUser",
  groups: ["groupOne", "groupTwo"],
  uid: "50",
  homeDir: "/tmp",
)
user("bob",
  groups: ["groupOne"],
  uid: "51",
  homeDir: "/home/bob",
)

Generates:

AWS::CloudFormation::Init:
  configSets:
    default:
    - main
  main:
    users:
      myUser:
        groups:
        - groupOne
        - groupTwo
        uid: '50'
        homeDir: "/tmp"
      bob:
        groups:
        - groupOne
        uid: '51'
        homeDir: "/home/bob"

Back to DSL Docs