Deploying Cloud Foundry on AWS with BOSH AWS Bootstrap
WARNING: The command |
Cloud Foundry tools simplify the process of deploying a Cloud Foundry instance to a variety of platforms, including Amazon Web Services (AWS). The following document guides you through using BOSH and the cf Command Line Interface (CLI) to deploy Cloud Foundry to Amazon Web Services.
Select a DNS domain name for your Cloud Foundry instance. For example, if you select the domain name cloud.example.com, Cloud Foundry deploys each of your applications as APP-NAME.cloud.example.com.
Create an AWS Route 53 Hosted Zone for your domain on the AWS Route 53 control panel. The control panel displays a delegation set, which is a list of addresses to which you must delegate DNS authority for your domain. For example, if you selected the domain name cloud.example.com, each address in the delegation set should become an NS record in the DNS server for example.com.
Ruby 1.9.3 and git (1.8 or later) are prerequisites for the following steps.
After you install Ruby and git, install the
$ gem install bundler
Create a deployments directory with a sub-directory for your deployment.
$ mkdir deployments $ cd deployments $ mkdir cf-example
In the sub-directory, create a file named
Gemfilewith the following contents:
source 'https://rubygems.org' ruby "1.9.3" gem "bosh_cli_plugin_aws"
bundle installto install the gems you specified in the
$ bundle install
Create a file named
bosh_environmentand add the following contents, replacing the values in each line to match your configuration:
export BOSH_VPC_DOMAIN=example.com export BOSH_VPC_SUBDOMAIN=my-subdomain export BOSH_AWS_ACCESS_KEY_ID=AWS_ACCESS_KEY_ID export BOSH_AWS_SECRET_ACCESS_KEY=AWS_SECRET_ACCESS_KEY export BOSH_AWS_REGION=my-aws-region export BOSH_VPC_PRIMARY_AZ=us-east-1a # see note below export BOSH_VPC_SECONDARY_AZ=us-east-1d # see note below
Note: The values you add for
BOSH_VPC_SUBDOMAINmust correspond to the DNS domain name you set up when configuring Route 53.
source bosh_environmentto set the environment variables required for deploying to AWS.
$ source bosh_environment
Note: The following steps only support deployment to the
us-east-1region of AWS.
To deploy MicroBOSH to a different region, see this guide.
Choose an availability zone that is listed as “operating normally” in the Health Status section of the the AWS Console for your region.
bosh aws createto create a VPC Internet Gateway, VPC subnets, three RDS databases, and a NAT VM for Cloud Foundry subnet routing. This command generates two receipt files,
aws_vpc_receipt.yml, that you use when deploying Cloud Foundry.
$ bosh aws create Executing migration CreateKeyPairs allocating 1 KeyPair(s) Executing migration CreateVpc . . . details in S3 receipt: aws_rds_receipt and file: aws_rds_receipt.yml Executing migration CreateS3 creating bucket xxxx-bosh-blobstore creating bucket xxxx-bosh-artifacts
Note: RDS database creation may take 20 or more minutes.
Refer to the instructions in the BOSH Deploying MicroBOSH to AWS topic to deploy MicroBOSH to AWS.
Create a manifest stub file named
cf-stub.yml. Customize the manifest stub for your environment.
$ git clone https://github.com/cloudfoundry/cf-release.git
updatehelper script to update the
$ cd cf-release $ ./update
Run the following Spiff command from the
cf-releasedirectory to create a deployment manifest named
./generate_deployment_manifest INFRASTRUCTURE MANIFEST-STUB > cf-deployment.yml
Replace INFRASTRUCTURE with
awsand replace MANIFEST-STUB with the name and location of your
cf-stub.yml file. For example:
$ ./generate_deployment_manifest aws cf-stub.yml > cf-deployment.yml
bosh targetto target the BOSH Director:
$ bosh target Current target is https://x.x.x.x:25555 (micro-xxxxxx)
Set your deployment to the generated manifest:
$ bosh deployment cf-deployment.yml
bosh create releaseto create a Cloud Foundry release. This command prompts you for a development release name.
$ bosh create release
bosh upload releaseto upload the generated release to the BOSH Director:
$ bosh upload release
Deploy the uploaded Cloud Foundry release:
$ bosh deploy
bosh deploycan take 2-3 hours to complete.
curlto test the API endpoint of your Cloud Foundry installation.
$ curl api.subdomain.domain/info
curlsucceeds, it should return the JSON-formatted information. If
curldoes not succeeds, check your networking and make sure your domain has an NS record for your subdomain.
You should be able to target your Cloud Foundry installation with the cf Command Line Interface (CLI) and log in as an administrator.
The user name,
adminand the password,
fakepassword, are specified in the deployment manifest under uaa:scim:users.
For more information about managing organizations, spaces, users, and applications, refer to the cf topic.
If you make change to your manifest, run
bosh deployto update your Cloud Foundry deployment with these changes.
If you make changes to the
bosh create release && bosh upload release && bosh deployto update your Cloud Foundry deployment with these changes.
If you want your Cloud Foundry to be able to provision services, you must deploy a services release. Refer to the services documentation.
You also might be interested in the community-managed services release.
bosh aws destroyto destroy your AWS environment.
WARNING: The command
bosh aws destroydestroys everything in your AWS account, including all S3 buckets and all instances. Do not use this command unless you want to lose everything in your AWS account, including objects and files unrelated to your Cloud Foundry deployment.
$ bosh aws destroy
Remove any YAML artifacts:
$ rm -f *.yml