Akamai : Simple Property
In this scenario, we will create a CDN property from scratch and make a simple change.
Requirements
Bossman (Install)
Access to Akamai Control Center
(Recommended) A dedicated Access Control Group (ACG, a folder in the control center)
(Recommended) Akamai OPEN credentials restricted to the ACG with read-write PAPI v1 privileges
A Content Provider Code
A domain name (this tutorial will refer to
example.com
)A Standard TLS Akamai Edge Hostname
A
$HOME/.edgerc
file with apapi
section (but you can configure that after reading Akamai Property)
We will be using https://httpbin.org as an origin server, but you are free to use a different one if you prefer.
Initializing the repository
git init bossman_quickstart_akamai_simple_property
Now that you have your git repository, Bossman needs a quick initialization as well.
cd bossman_quickstart_akamai_simple_property
bossman init
All set.
Preparing the directory structure
By default, bossman expects the following tree structure:
$ tree
.
└── akamai
└── property
└── bossman_from_scratch
├── hostnames.json
└── rules.json
3 directories, 2 files
The akamai/property
prefix identifies the plugin to use. The Akamai property plugin expects subdirectories to be property names.
With this file tree, we will be managing a property called bossman_from_scratch
.
Two Akamai properties cannot have the same name within an account!
Creating this structure is trivial:
mkdir -p akamai/property/bossman_from_scratch
Creating the hostnames.json
file
This file describes the hostname mapping for the property, more information here:
PAPI V1 : PUT Property Hostnames.
You can use this as a template
1[
2 {
3 "cnameFrom": "bossmanfromscratch.example.com",
4 "cnameTo": "your-edge-hostname.edgesuite.net",
5 "cnameType": "EDGE_HOSTNAME"
6 }
7]
Simply make sure you replace example.com
and your-edge-hostname
with your
own values.
Creating the rules.json
file
This file describes the delivery and caching rules that should be applied to traffic served by the configuration.
It obeys a schema described in the PAPI Feature Catalog Reference. This schema is versioned, and we will use a frozen version for the sake of stability in this tutorial.
You can use the following as a template:
1{
2 "contractId": "YOUR_CONTRACT_ID",
3 "groupId": "YOUR_GROUP_ID",
4 "productId": "YOUR_PRODUCT_ID",
5 "ruleFormat": "v2020-03-04",
6 "rules": {
7 "name": "default",
8 "comments": "The behaviors in the Default Rule apply to all requests.",
9 "options": {
10 "is_secure": false
11 },
12 "behaviors": [
13 {
14 "name": "origin",
15 "options": {
16 "cacheKeyHostname": "ORIGIN_HOSTNAME",
17 "compress": true,
18 "customValidCnValues": [
19 "{{Origin Hostname}}",
20 "{{Forward Host Header}}"
21 ],
22 "enableTrueClientIp": false,
23 "forwardHostHeader": "REQUEST_HOST_HEADER",
24 "hostname": "httpbin.org",
25 "httpPort": 80,
26 "httpsPort": 443,
27 "originCertsToHonor": "STANDARD_CERTIFICATE_AUTHORITIES",
28 "originSni": true,
29 "originType": "CUSTOMER",
30 "standardCertificateAuthorities": [
31 "akamai-permissive"
32 ],
33 "verificationMode": "PLATFORM_SETTINGS"
34 }
35 },
36 {
37 "name": "cpCode",
38 "options": {
39 "value": {
40 "id": YOUR_CPCODE_ID
41 }
42 }
43 },
44 {
45 "name": "caching",
46 "options": {
47 "behavior": "MAX_AGE",
48 "mustRevalidate": false,
49 "ttl": "31d"
50 }
51 }
52 ]
53 }
54}
Quick validation
Bossman can help you validate your working copy using this command:
bossman validate
This will list each resource with a thumbs up emoji if validation passed.
First commit & deployment
Bossman does not deploy from working copy, so we need to commit our changes.
git add akamai
git commit -m "init"
Before deploying this change, we can check the status:
We can create the property and deploy the change from here:
And we can look at the status again:
Activating to staging
Now we are ready to activate the property to staging.
After the process completes, we can check the status again:
We have an indication that v1 is active on the staging network.
And we can see the result of our efforts in Akamai Control Center!
Congratulations!
Next step: Akamai : Parallel Environments