Create a Elastic Beanstalk environment
Configure Security Group
In the AWS console, open the EC2 tab.
Select the relevant region and click on Security Group.
You should have an elasticbeanstalk-default security group if you have launched an Elastic Beanstalk instance in that region.
Edit the security group to add a rule for SSH access. The below will lock it down to only allow ingress from a specific IP address.
SSH | tcp | 22 | 22 | 192.168.1.1/32e
To change an instance’s security groups
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
In the navigation pane, choose Instances.
Open the context (right-click) menu for the instance and choose Networking, Change Security Groups.
In the Change Security Groups dialog box, select one or more security groups from the list and choose Assign Security Groups.
Configure the environment of your Elastic Beanstalk Application
If you haven’t made a key pair yet, make one by clicking Key Pairs below Security Group in the ec2 tab.
In the AWS console, open the Elastic Beanstalk tab.
Select the relevant region.
Select relevant Environment
Select Configurations in left pane.
Select Instances.
Under “EC2 key pair:”, select the name of your keypair in the Existing Key Pair field.
Once the instance has relaunched, you need to get the host name from the AWS Console EC2 instances tab, or via the API. You should then be able to ssh onto the server.
$ ssh -i path/to/keypair.pub ec2-user@ec2-an-ip-address.compute-1.amazonaws.com
Note: For adding a keypair to the environment configuration, the instances’ termination protection must be off as Beanstalk would try to terminate the current instances and start new instances with the KeyPair.
Note: If something is not working, check the “Events” tab in the Beanstalk application / environments and find out what went wrong.
Virtual Env.
[ec2-user@ip-172-31-0-207 ~]$ virtualenv -p python2.7 /tmp/trinimbus
Already using interpreter /usr/bin/python2.7
New python executable in /tmp/trinimbus/bin/python2.7
Also creating executable in /tmp/trinimbus/bin/python
Installing setuptools, pip…done.
[ec2-user@ip-172-31-0-207 ~]$
The virtual environment prints its name (for example: (Tamerity) at the beginning of each command prompt, reminding you that you’re in a virtual Python environment.