-
Install Vagrant AWS provider
$ vagrant plugin install vagrant-awsKnown working version: 0.4.1
-
If you don't already have one, create an AWS Access Key. Set environment variables
BOSH_AWS_ACCESS_KEY_IDandBOSH_AWS_SECRET_ACCESS_KEY. -
Create an SSH key pair so that you can SSH into Bosh Lite once it is deployed. If you generate an EC2 Key Pair in AWS the private key will be downloaded. Call the EC2 Key Pair
boshor set the environment variableBOSH_LITE_KEYPAIRto the name you gave. SetBOSH_LITE_PRIVATE_KEYto the local file path for the private key (defaults to~/.ssh/id_rsa_bosh).
Set the environment variables:
$ export BOSH_AWS_ACCESS_KEY_ID=
$ export BOSH_AWS_SECRET_ACCESS_KEY=
$ export BOSH_LITE_PRIVATE_KEY=
- If you don't already have one, create a VPC. If you use the VPC Wizard, a Security Group and a Subnet will be created for you. If you create the VPC manually a Security Group will be created automatically but you must manually create a Subnet.
- Set the environment variable
BOSH_LITE_SECURITY_GROUPto the Group ID (e.g.sg-62166d1a) of a Security Group associated with the VPC. Note: this is different from EC2-Classic, where the Group Name is used. - By default Security Groups only allow access from within the Security Group. Modify the Security Group to allow inbound traffic from anywhere (set Source to
0.0.0.0/0).
- If you want to lock down access, set Source to your IP address. You can also limit what ports are opened; BOSH Lite requires inbound traffic on ports 25555 (for the BOSH director), 22 (for SSH), 80/443 (for Cloud Controller), and 4443 (for Loggregator).
- If you don't already have one, create a Subnet. Set the environment variable
BOSH_LITE_SUBNET_IDto the Subnet ID (e.g.subnet-37d0526f). - By default, VMs will not be assigned a public IP on creation. Modify the Subnet to Enable auto-assign Public IP.
- Continue to Deploy BOSH Lite.
- Create a Security Group with name
inception, or set the environment variableBOSH_LITE_SECURITY_GROUPto the Group Name of the security group you created. Do not use Group ID, as the deploy will fail unless the Security Group is associated with a VPC. - Continue to Deploy BOSH Lite.
The full list of supported environment variables follows:
| Name | Description | Default |
|---|---|---|
| BOSH_AWS_ACCESS_KEY_ID | AWS Access Key ID | |
| BOSH_AWS_SECRET_ACCESS_KEY | AWS Secret Access Key | |
| BOSH_LITE_REGION | AWS Region name | us-east-1 |
| BOSH_LITE_KEYPAIR | AWS EC2 Key Pair name | bosh |
| BOSH_LITE_PRIVATE_KEY | Local file path for private key matching BOSH_LITE_KEYPAIR |
~/.ssh/id_rsa_bosh |
| BOSH_LITE_SECURITY_GROUP | AWS Security Group. For EC2-Classic, where Security Groups are created manually, use the value of Group Name. For VPC, where the Security Group is created automatically, use the value of Group ID; e.g. sg-62166d1a. |
inception |
| BOSH_LITE_SUBNET_ID | AWS VPC Subnet ID (Not necessary for EC2 Classic. Use the ID, not the name; e.g. subnet-37d0526f) |
|
| BOSH_LITE_NAME | AWS EC2 instance name | Vagrant |
See vagrant-aws.tpl for all environment variables.
-
Run vagrant up with provider
aws:$ vagrant up --provider=aws -
If you haven't already, install the BOSH CLI
See bosh.io for instructions.
-
Target the BOSH Director and login
- Use the public IP found in the output of
vagrant upor the hostname returned by runningvagrant ssh-config - Default credentials are admin/admin
$ bosh target <public_ip_of_the_box> Target set to `Bosh Lite Director' $ bosh login Your username: admin Enter password: ***** Logged in as `admin' - Use the public IP found in the output of
Instructions are the same as for local deployment.
- To use
bosh sshto log into a VM of a deployment, you must provide the public IP of your VM (unless you've configured a DNS name), the user to log in as (note: this isubuntu, notvcapas for Cloud Foundry deployments), and the private key for the SSH key pair you generated above. You can provide the private key on the command line, or add it to your key chain.bosh ssh etcd_z1 --gateway_host 52.87.6.252 --gateway_user ubuntu --gateway_identity_file bosh.pem - As part of Vagrant provisioning bosh-lite is setting IP tables rules to direct future traffic received on the instance to another IP (the HAProxy). These rules are cleared on restart. In case of restart they can be created by running
vagrant provision.
The following instructions involve modifying the Vagrantfile found in the cloned bosh-lite directory.
-
The AWS bosh-lite VM will echo its private IP on provisioning so that you can target it. You can disable this by uncommenting the
public_ipprovisioner in theawsprovider.config.vm.provider :aws do |v, override| override.vm.provision :shell, id: "public_ip", run: "always", inline: "/bin/true" end -
Port forwarding on HTTP/S ports is set up for the CF Cloud Controller on the AWS VM. If you are not going to deploy Cloud Contorller (or just don't want this), you can disable this by uncommenting the
port_forwardingprovisioner in theawsprovider.config.vm.provider :aws do |v, override| override.vm.provision :shell, id: "port_forwarding", run: "always", inline: "/bin/true" end -
AWS boxes are published for the following regions: us-east-1, us-west-1, us-west-2, eu-west-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, sa-east-1. Default region is us-east-1. To use a different region add
regionconfiguration to theawsprovider.config.vm.provider :aws do |v, override| v.region = "us-west-2" end