Skip to content

Instantly share code, notes, and snippets.

@ScreamingHawk
Created September 26, 2017 23:52
Show Gist options
  • Select an option

  • Save ScreamingHawk/fa18dac64972f89c1fc03edecc017959 to your computer and use it in GitHub Desktop.

Select an option

Save ScreamingHawk/fa18dac64972f89c1fc03edecc017959 to your computer and use it in GitHub Desktop.

Revisions

  1. ScreamingHawk created this gist Sep 26, 2017.
    80 changes: 80 additions & 0 deletions create_admin.template
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,80 @@
    {
    "AWSTemplateFormatVersion": "2010-09-09",
    "Parameters": {
    "AdminName": {
    "NoEcho": "false",
    "Type": "String",
    "Description": "New admin account name",
    "MinLength": "1",
    "MaxLength": "41",
    "AllowedPattern": "[a-zA-Z0-9]*",
    "ConstraintDescription": "Must contain only alphanumeric characters."
    },
    "AdminPassword": {
    "NoEcho": "true",
    "Type": "String",
    "Description": "New admin account password",
    "MinLength": "16",
    "MaxLength": "41",
    "AllowedPattern": "[a-zA-Z0-9]*",
    "ConstraintDescription": "Must contain only alphanumeric characters."
    }
    },
    "Resources": {
    "AdminUser": {
    "Type": "AWS::IAM::User",
    "Properties": {
    "Groups": [
    {
    "Ref": "AdminGroup"
    }
    ],
    "UserName": {
    "Ref": "AdminName"
    },
    "LoginProfile": {
    "Password": {
    "Ref": "AdminPassword"
    }
    }
    }
    },
    "AdminGroup": {
    "Type": "AWS::IAM::Group",
    "Properties": {
    "GroupName": "Admin",
    "ManagedPolicyArns": [
    "arn:aws:iam::aws:policy/AdministratorAccess"
    ]
    }
    },
    "AdminKey": {
    "Type": "AWS::IAM::AccessKey",
    "Properties": {
    "UserName": {
    "Ref": "AdminUser"
    }
    }
    "DependsOn": [
    "AdminUser"
    ]
    }
    },
    "Outputs": {
    "AccessKey": {
    "Value": {
    "Ref": "AdminKey"
    },
    "Description": "AWSAccessKeyId of admin user"
    },
    "SecretKey": {
    "Value": {
    "Fn::GetAtt": [
    "AdminKey",
    "SecretAccessKey"
    ]
    },
    "Description": "AWSSecretKey of admin user"
    }
    }
    }