0

I'm trying to create Beanstalk app with Network load balancer in new VPC (one public, one private subnet, internet gateway, nat gateway...)

I can create successfully in my personal aws account.

With account of my organization, I have this error "VPC does not exist":

eb create Dev-Price-Availability-API-App-Dev -i t2.micro --vpc --vpc.id vpc-e753b89d

Do you want to associate a public IP address? (Y/n): n
Enter a comma-separated list of Amazon EC2 subnets: subnet-2903f417
Enter a comma-separated list of Amazon ELB subnets: subnet-2903f417
Enter a comma-separated list of Amazon VPC security groups: sg-c382d588
Do you want the load balancer to be public? (Select no for internal) (Y/n): n
NOTE: The current directory does not contain any source code. Elastic Beanstalk is launching the sample application instead.
ERROR: ServiceError - Configuration validation exception: The VPC 'vpc-e753b89d' does not exist.

I try to reproduce many times (create new VPC...), and the script always run successfully in my personal AWS but having the same error in organization AWS. All subnet of vpc and beanstalk are in the same region (us-east-1).

Sometimes, the script throws "subnet does not exist", "securitygroups does not exists" Does anyone have the same issue, could you give me some ideas?

hoang
  • 1,444
  • 11
  • 19
  • hoang, does your organization's account have the VPC, `vpc-e753b89d`? Does the output of `aws ec2 describe-vpcs --region us-east-1 | grep "VpcId"` show the above VPC id? – progfan Jul 02 '18 at 19:39
  • sure, I can get the result with that command and it shows 5 vpcs including vpc-e753b89d – hoang Jul 04 '18 at 09:04
  • Okay, and just to make sure -- during `eb init` , you set the region as `us-east-1`? can you double-check the value set in the `.elasticbeanstalk/config.yml` file? – progfan Jul 04 '18 at 09:19
  • I don't have that file @progfan. I have .aws/credentials file and that contain 2 profile: [default] and [myorganization] profile. When I run aws cli and eb cli, I export AWS_PROFILE=myorganization. – hoang Jul 05 '18 at 01:28

1 Answers1

0

I think there is a bug from EB CLI. Currently I use: EB CLI 3.14.1 (Python 3.6.5). When I run eb cli, eb always take my default aws profile even though I set aws profile to my organization profile.

[default]
region=us-west-2
aws_access_key_id=....
aws_secret_access_key=...

[myorganization]
aws_access_key_id=...
aws_secret_access_key=...
region=us-east-1
output=json

So the way I did is: - Backup my default profile - Rename my organization profile to default Then I can run eb command successfuly without error.

Thanks

hoang
  • 1,444
  • 11
  • 19
  • 1
    Yes, the CLI does not use the same environment variables that the AWS CLI uses. In order to use a different profile than normal, you have to pass the `--profile` argument. However, this is by design. – progfan Jul 05 '18 at 03:52
  • Thanks @progfan. It's new for me to know that. – hoang Jul 05 '18 at 15:52