#!/bin/bash

userArn=$(aws iam get-user --query User.Arn);
baseArn=${userArn:1:26};

aws iam create-user --user-name alsl-ec2-launch
aws iam create-policy --policy-name alsl-ec2-launch --policy-document file://alsl-ec2-launch-policy.json
aws iam attach-user-policy --user-name alsl-ec2-launch --policy-arn ${baseArn}policy/alsl-ec2-launch

#!/bin/bash

aws iam create-user --user-name alsl-ec2-launch
aws iam create-policy --policy-name alsl-ec2-launch --policy-document file://alsl-ec2-launch-policy.json
aws iam attach-user-policy --user-name alsl-ec2-launch --policy-arn 

--- 
+++ 
@@ -1,5 +1,8 @@
 #!/bin/bash
+
+userArn=$(aws iam get-user --query User.Arn);
+baseArn=${userArn:1:26};
 
 aws iam create-user --user-name alsl-ec2-launch
 aws iam create-policy --policy-name alsl-ec2-launch --policy-document file://alsl-ec2-launch-policy.json
-aws iam attach-user-policy --user-name alsl-ec2-launch --policy-arn 
+aws iam attach-user-policy --user-name alsl-ec2-launch --policy-arn ${baseArn}policy/alsl-ec2-launch
Fix script to attache policy
