InvalidParameterValue => Value () for parameter groupId is invalid
adeshp17 opened this issue · 0 comments
I am trying to create a test EC2 instance in my Private subnet through Bastion (using SSH multiplexing) but was kept getting the above error.
Online search suggested that it was the Security Group for Custom VPC's should be declared using GroupID (rather than GroupName for default VPC), but that did not work.
The issue was resolved by providing the subnet _id field in my Vagrantfile and it created the instance without any errors inside my Private Subnet
config.vm.box = "aws"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider :aws do |aws, override|
aws.access_key_id = ENV['AWS_ACCESS_KEY']
aws.secret_access_key = ENV['AWS_SECRET_KEY']
aws.region = "us-west-2"
# aws.availability_zone = "us-west-2"
# AMI from which we'll launch EC2 Instance
aws.ami = "ami-<ami-id>" # Ubuntu 14.04
aws.keypair_name = "<KEY_FILE_NAME>" #(.pem excluded)
aws.instance_type = "t2.micro"
aws.block_device_mapping = [{ 'DeviceName' => '/dev/sda1', 'Ebs.VolumeSize' => 10 }]
aws.security_groups = ["sg-<private_subnet_SG>"] #make sure use ID and not GroupName
aws.subnet_id = "<Your_private_Subnet_ID>"
# aws.tags = {
# 'Name' => 'Vagrant EC2 Instance',
# 'Environment' => 'vagrant-sandbox'
#S }
# Credentials to login to EC2 Instance
override.ssh.username = "<username>"
override.ssh.private_key_path = ENV['AWS_PRIVATE_KEY']
end