Dev > PaaS > CloudFoundry > PCF

Warning

This article was automatically translated by OpenAI (gpt-4o).It may be edited eventually, but please be aware that it may contain incorrect information at this time.

Previous article covered the installation of VMware Tanzu Application Service for VMs (TAS) on AWS.
In this article, we will introduce a method to significantly reduce EC2 instance usage costs by using Spot Instances.

Table of Contents

Creating a VM Extension

Whether to use Spot Instances for VMs in TAS can be configured with a VM Extension.

Define the use of spot instances in vm-extension-spot-instance.yml. The spot_bid_price is the maximum price (USD/hour) for the Spot Instance auction. Here, we set it to $1.0.
For VMs used in TAS, it is assumed that any price will win the auction since it won't reach $1.0.

cat <<EOF > vm-extension-spot-instance.yml
---
vm-extension-config:
  name: spot-instance
  cloud_properties:
    spot_bid_price: 1.0
    spot_ondemand_fallback: true
---
EOF

Register the VM Extension with Ops Manager.

om --env env.yml create-vm-extension -c vm-extension-spot-instance.yml

Next, configure the application of this VM Extension to each VM in TAS in additional-vm-extensions-cf.yml.
Make sure to aggregate and configure all the VM Extensions you use.

cat <<EOF > additional-vm-extensions-cf.yml
---
product-name: cf
resource-config:
  compute:
    additional_vm_extensions:
    - spot-instance
  control:
    additional_vm_extensions:
    - ssh-lb-security-groups
    - cloud-controller-iam
    - spot-instance
  database:
    additional_vm_extensions:
    - spot-instance
  router:
    additional_vm_extensions:
    - web-lb-security-groups
    - spot-instance
---
EOF

Apply this configuration to Ops Manager.

om --env env.yml configure-product -c additional-vm-extensions-cf.yml

Apply Changes

Click "REVIEW PENDING CHANGES" from the Ops Manager dashboard.

Check the "SEE CHANGES" for both "BOSH Director" and "Small Footprint VMware Tanzu Application Service".

image

If the Diff looks like the following, it's OK.

image image

After confirming, return to the original page and click the "APPLY CHANGES" button.

Once the settings are applied, check that the "Instance Lifecycle" of the TAS VM is spot from the list of EC2 instances.

image

You can also check the four requests from the list of spot requests.

image

As of July 1, 2024, the prices are as follows:

VM Type On-Demand Price Spot Price
r5a.large $0.1370 $0.0484
t3a.micro $0.0122 $0.0042
t3a.medium $0.0490 $0.0170

This results in approximately 65% cost savings.

If a Spot Instance VM is deleted, BOSH Director will rejoin the auction and automatically create a new VM at the new price.

Found a mistake? Update the entry.
Share this article: