Reputation: 33
I am creating autoscaling launch configuration via AWS CLI with this command
aws autoscaling create-launch-configuration --launch-configuration-name mylaunchconfig --key-name mykeypair --image-id ami-12345678589d597d1 --security-groups My-Private-SG --instance-type t3a.small
While executing this command I'm getting this error
An error occurred (ValidationError) when calling the CreateLaunchConfiguration operation: The security group 'My-Private-SG' does not exist in default VPC 'vpc-abce07df'
However, there is no option available to specify VPC ID in CLI
aws autoscaling create-launch-configuration help
create-launch-configuration
--launch-configuration-name <value>
[--image-id <value>]
[--key-name <value>]
[--security-groups <value>]
[--classic-link-vpc-id <value>]
[--classic-link-vpc-security-groups <value>]
[--user-data <value>]
[--instance-id <value>]
[--instance-type <value>]
[--kernel-id <value>]
[--ramdisk-id <value>]
[--block-device-mappings <value>]
[--instance-monitoring <value>]
[--spot-price <value>]
[--iam-instance-profile <value>]
[--ebs-optimized | --no-ebs-optimized]
[--associate-public-ip-address | --no-associate-public-ip-address]
[--placement-tenancy <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]
How can I create launch configuration along with specifying security group exists in non-default VPC.
Thanks in advance.
Upvotes: 1
Views: 650
Reputation: 4506
You should specify the security-groupId instead of name. The security-groupId is generated by aws.
your command should be something like below:
aws autoscaling create-launch-configuration --launch-configuration-name mylaunchconfig --key-name mykeypair --image-id ami-12345678589d597d1 --security-groups sg-xxxxxxxx --instance-type t3a.small
where sg-xxxxxxxx
is your security-groupId.
Upvotes: 1