amazon web services - AWS Ruby-sdk: How can I create a IAM user with auto generated password -
i using aws ruby-sdk create iam user specifying username. password should auto-generated. couldn't find related in api docs (http://docs.aws.amazon.com/sdkforruby/api/index.html)
iam not have auto-generate password feature in api. web console providing functionality on behalf of users. create password user using aws sdk ruby, can following:
require 'aws-sdk' iam = aws::iam::resource.new user = iam.create_user(user_name: 'name') user.create_login_profile(password: 'randompassword', password_reset_required: false)
you can of course use method prefer randomize password. simple mechanism use securerandom ruby's standard library:
# creates random password of 10 hex characters (length 2x given n) require 'securerandom' password = securerandom.hex(5) #=> "764d9308a3"
Comments
Post a Comment