File this under “I hope this helps someone else in the future“.
I was learning Docker and Kubernetes recently and I was trying to get my docker instance running on Amazon AWS Elastic Beanstalk on the
I had to configure my beanstalk environment to use a
t2.small instance because the
npm install command on the t1.micro was timing out.
Upon upgrading and pushing a new version to Travis CI (flow was Git -> Travis CI -> S3 -> Beanstalk) I’d get these errors:
- Environment named Docker-env is in an invalid state for this operation.
- Auto Scaling activity failed 5 minutes ago with error: The specified instance type can only be used in a VPC.
- Message:The security token included in the request is expired
- Service:Amazon S3, Message:The provided token has expired.
- A search on the web wasn’t that useful for any of these errors, so hopefully this helps someone by my including them here. Here’s how I fixed this …
I didn’t have a default VPC for the us-east-1 region. I needed to create one. (If you accidentally deleted the AWS Amazon Default VPC – see below for how to set it up again).
My problem was that my account is a very old AWS account (I’ve had it forever – set it up probably in 2008-ish) and my us-east-1 did not have a default VPC (needed for a t2.small). I could not create a default VPC (under the ‘Actions’ menu in the AWS VPC section for us-east-1) because my account in
us-east-1 was a
EC2-Classic and it needed to be an
EC2-VPC. Long story short, regions have certain configurations and my configuration was set to
EC2-Classic and that was causing a mess of problems.
If you can create a Default VPC, do so. There is a link below to show you how to do that. If you can’t … read on …
To fix this I had to submit a support request to Amazon to ask them to upgrade my
us-east-1 region to
EC2-VPC from an
To do that you’ll create a support request (while logged into AWS).
- Open a new support case in the support console
- Regarding: Account and Billing Support
- Service: Account
- Category: Convert EC2 Classic to VPC
Then fill out your request (ask them to upgrade you to EC2-VPC for that region) and you should be good to go.
In order to keep continuing on my local developments while Amazon converted me to EC2-VPC, I changed regions to Ohio (
us-east-2) and recreated a new beanstalk environment and application. This region almost always has a default VPC. If you deleted it on accident, see the link below for how to re-enable the default VPC on that region.
Once your new AWS Beanstalk environment is set up, go into the configuration and change it from t1.micro to t2.small.
Wait for the changes to take effect.
Presto, docker instance is deployed and I can access the web app via the beanstalk url.