Set up Cloudlets policies
Cloudlets are our applications at the edge of the content delivery platform. Each Cloudlet helps to solve specific challenges and bring your site's business logic closer to your end user.
Before you begin
- Understand the basics of Terraform.
- Complete the steps in Get started.
- Have at least one property created in the group and contract with which you manage your web assets. Use the
akamai_property
resource to create or import properties. - For Cloudlets that forward incoming requests, set up a separate origin.
- For the Application Load Balancer Cloudlet, set up a load balancing configuration.
Create Cloudlet policies
A policy is a versioned container for the rules that govern how a Cloudlet behaves. You can create a new policy or use an existing one.
The Cloudlets subprovider does not support shared policies. To use them, see the Cloudlets API or the Akamai PowerShell module.
Create new
To create a new policy, use your Cloudlet type as a code in the akamai_cloudlets_policy resource.
resource "akamai_cloudlets_policy" "my-new-cloudlet-policy" {
name = "policy1"
cloudlet_code = "ER"
group_id = "12345"
New policies are empty and the system automatically sets the version number at one.
Get existing
Use the name of the policy you want as the value for the export-cloudlets-policy
argument of the akamai
CLI command.
akamai terraform --edgerc {location-of-your-edgerc-file} --section {section-of-edgerc-to-use} export-cloudlets-policy {"policy-name"}
Run the included import script to populate your Terraform state. This prevents Terraform from attempting to recreate your assets.
Add rules to policies
For each policy you have, you can specify up to 5000 rules. Cloudlet rules contain general settings specific to the Cloudlet you're using, an if statement that sets the match criteria, and a then statement for the action to take. Add them directly with resource attributes or reference a JSON-encoded output of the match rule data source.
Order your rules so that the ones that will exclude the most incoming requests are towards the top of the list. If an incoming request doesn't trigger a rule, then the Cloudlet doesn't execute, and the request is then evaluated against your property rules.
Cloudlets don't support child rules or else statements.
Activate Cloudlet policies
Once you're satisfied with a policy version, use the akamai_cloudlets_policy_activation
resource to associate your Cloudlet's policy version with one or more properties in a compatible group.
Run terraform apply
to deploy your policy to either the staging or production network.
Once you activate a policy version on either of the networks, any change to the
akamai_cloudlets_policy
resource creates and activates a new version upon runningterraform apply
.
Assign Cloudlet to property
To implement an activated Cloudlet on the edge, you need to add your Cloudlet's behavior to the JSON rule tree file in each property associated with your policy. See [Property Provisioning](doc: et-up-property-provisioning) for detailed instructions.
To customize the settings, see the behavior for your Cloudlet in the Property Manager API (PAPI) documentation:
Cloudlet | Behavior |
---|---|
API Prioritization | api_prioritization |
Application Load Balancer | application_load_balancer |
Audience Segmentation | audience_segmentation |
Edge Redirector | edge_redirector |
Forward Rewrite | forward_rewrite |
Phased Release | phased_release |
Request Control | request_control |
Visitor Prioritization | visitor_prioritization |
Activate property
Use the akamai_property_activation
resource to activate the modified property version on the production network. An active Cloudlet policy won't be applied to the user requests unless you activate the property version with appropriate Cloudlet behavior enabled.
Run terraform apply
again to implement the changes.
Additional information
For information on each of our Cloudlets, see Available Cloudlets.
Updated about 1 year ago