kenchew kenchew - 4 months ago 19
Ruby Question

How to get started using aws_account_utils (ruby)?

After searching around, I found this aws_account_utils which does exactly what I hope to achieve - programmatically create aws account.

Unfortunately as a total ruby noob, I have no idea how to start using it even after reading the README.md.

I suspect I'd need the following steps:


  1. Create
    create-account.rb

  2. Use the util in the code

  3. Run
    ruby create-account.rb



How should the content of
create-account.rb
be like?

Please show me a template.
With that I should be able to start experimenting and hacking.

Any other steps I should do?

Thanks in advance.

Answer

Plan below is rough and must be supplemented.

  1. Create Gemfile file. This file is needed to specify project dependencies (libraries)

  2. Put this line into Gemfile

    gem 'aws_account_utils'
    
  3. Run bundle install in your console / terminal

  4. Create create-account.rb file with next code

    require 'aws_account_utils'
    
    aws_utils = AwsAccountUtils::AwsAccountUtils.new()
    
    details = { 'fullName'     => 'Herman Munster',
          'company'      => 'The Munsters',
          'addressLine1' => '1313 Mockingbird Lane',
          'city'         => 'Mockingbird Heights',
          'state'        => 'CA',
          'postalCode'   => '92000',
          'phoneNumber'  => '(800) 555-1212',
          'guess'        => 'Test Account' }
    
    resp = aws_utils.create_account(account_name: 'My Test Account 01',
                                account_email: 'adfefef@gmail.com',
                                account_password: 'foobar1212121',
                                account_details: details)
    

    This code uses aws_account_utils library. Documentation you can find here.

After steps above you can run ruby create-account.rb.