I was trying to create an EBS volume by writing a shell script in the user data of my launch configuration. I don't think there is anything wrong with my bash script. I kept looking up creating launch configuration and writing user data in AWS websites, but could not find anything more than what I did below. For my launch configuration, I used Amazon Linux 2 AMI which has pre-built AWS CLI. So I just wrote the following code in my user data:
#!/bin/bash aws ec2 create-volume \ --volume-type gp2 \ --size 100 \ --encrypted \ --availability-zone us-east-1c aws ec2 create-volume \ --volume-type gp2 \ --size 100 \ --encrypted \ --availability-zone us-east-1d
As you can see I am trying to create EBS volumes in two availability zones, but I just could not find out why it does not create any volume for me?