Enable EdgeWorkers
Dynamically manage your web traffic, customize visitor experiences, and eliminate trips to your origin by deploying your custom JavaScript together with our EdgeWorkers code on the edge.
To set up a distributed key-value store for EdgeWorkers, see the EdgeKV integration guide for details.
Get EdgeWorkers
Get a list of all your current EdgeWorkers. To get details of a specific EdgeWorker, use its name or ID.
# Get all
Get-Edgeworker
# Get one
Get-Edgeworker -EdgeWorkerName my-edgeworker-1
edgeWorkerId : 12345
name : my-edgeworker-1
accountId : A-CCT1234
groupId : 12345
resourceTierId : 200
createdBy : jsmith
createdTime : 11/29/2023 11:24:31 AM
lastModifiedBy : jsmith
lastModifiedTime : 12/29/2023 12:52:01 PM
edgeWorkerId : 56789
name : my-edgeworker-2
accountId : A-CCT1234
groupId : 12345
resourceTierId : 100
createdBy : jsmith
createdTime : 12/1/2023 8:22:21 AM
lastModifiedBy : jsmith
lastModifiedTime : 12/1/2023 8:22:21 AM
edgeWorkerId : 12345
name : my-edgeworker-1
accountId : A-CCT1234
groupId : 12345
resourceTierId : 200
createdBy : jsmith
createdTime : 11/29/2023 11:24:31 AM
lastModifiedBy : jsmith
lastModifiedTime : 12/29/2023 12:52:01 PM
The response provides values for groupId, edgeworkerID, and name you can use in downstream commands.
Create a new EdgeWorker
Create a new EdgeWorker using your group ID and assigning a resource tier. Resource tiers let you select between different sets of resource consumption limits for your EdgeWorker's functions.
New-EdgeWorker -EdgeWorkerName my-edgeworker -GroupID 12345 -ResourceTierID 200
edgeWorkerId : 54321
name : my-edgeworker
accountId : A-CCT1234
groupId : 12345
resourceTierId : 200
createdBy : jsmith
createdTime : 1/11/2024 9:43:29 PM
lastModifiedBy : jsmith
lastModifiedTime : 1/11/2024 9:43:29 PM
List resource tiers
Get a list of your EdgeWorkers' resource tiers with your contract ID.
Get-EdgeWorkerResourceTier -ContractId C-0N7RAC7
resourceTierId resourceTierName edgeWorkerLimits
-------------- ---------------- ----------------
100 Basic Compute {@{limitName=Maximum CPU time during initialization; limitValue=60; limitUnit=MILLISECOND}, @{limitName=Maximum wal…
200 Dynamic Compute {@{limitName=Maximum CPU time during initialization; limitValue=60; limitUnit=MILLISECOND}, @{limitName=Maximum wal…
Update an EdgeWorker
You can update the name of an existing EdgeWorker or create a new version of your EdgeWorker to update its code bundles.
Update name
Using the Set command with your group ID, pass values for both the old name and a new name.
Set-Edgeworker -EdgeWorkerName my-edgeworker -NewName my-edgeworker-new-name -GroupID 12345
edgeWorkerId : 54321
name : my-edgeworker-new-name
accountId : A-CCT1234
groupId : 12345
resourceTierId : 200
createdBy : jsmith
createdTime : 11/29/2022 11:24:31 AM
lastModifiedBy : jsmith
lastModifiedTime : 1/11/2023 10:07:50 PM
Update with a new version
To update an existing EdgeWorker with a new code bundle, create a new version and provide the file path.
This requires your operating system to support the
tarcommand. Windows only started shippingtarwith Windows 10 version 17063. If your version of Windows is older than that, you will need to create the.tgzmanually.
# Windows
\---demo_ew
bundle.json
main.js
# MacOS or Linux
~/demo_ew ls -a
. .. bundle.json main.js
# Windows
New-EdgeWorkerVersion -EdgeWorkerName my-edgeworker -CodeDirectory .\demo_ew\
# Mac
# 1. Change into your code bundle's directory
$ cd demo_ew
# 2. Create a .tar file of the contents
$ tar czf example.tgz *
# 3. Pass exact path to the .tar to create a new version
$ New-EdgeWorkerVersion -EdgeWorkerName my-edgeworker -CodeBundle ~/demo_ew/example.tgz
edgeWorkerId : 54321
version : 6
accountId : A-CCT1234
checksum : checksum0d383242729cf94c893caf8aeacc150ed72af368a6903f34b2c1a4ab
sequenceNumber : 2
createdBy : jsmith
createdTime : 1/12/2023 7:40:45 PM
For Windows users, PowerShell will read the version number from the bundle.json file, create a .tgz file from the contents of the folder, excluding any other .tgz present, and push out your bundle update.
For Mac or Linux users, you have to create the .tgz yourself and then run the version command to push your bundle update.
When you're done making changes, activate your Edgeworker on the network.
Activate an EdgeWorker
When you're ready to apply your changes, activate your EdgeWorker on either STAGING or PRODUCTION.
New-EdgeWorkerActivation -EdgeWorkerName my-edgeworker -Version latest -Network STAGING
edgeWorkerId : 54321
version : 6
activationId : 1
accountId : A-CCT1234
status : PRESUBMIT
network : STAGING
createdBy : jsmith
createdTime : 1/12/2023 8:17:32 PM
lastModifiedTime : 1/12/2023 8:17:32 PM
Your activation will cycle through presubmit and pending states before it's complete and live on the network you chose.
Updated 8 days ago
