Simple read-only access to Azure Blob storage containers
Typically the azure-blob-proxy runs in Azure Kubernetes Service (AKS)
as a k8s deployment and proxies http requests to a designated blob storage container.
Example manifests can be found at examples/manifests.
The example contains azure-blob-proxy with a combination of Nginx working
as cache in front of it. Using Nginx can significantly reduce the load on
Azure blob storage and increase response speed.
The examples/terraform folder contains sample terraform code for creating an Azure blobs storage, container, example blob and workload identity for AKS.
Note
Learn how to create, load, and list blobs using the Azure CLI in the official docs
az loginexport AZURE_LOCATION=eastus2
export AZURE_RESOURCE_GROUP=azure-blob-proxy-demo
export AZURE_STORAGE_ACCOUNT=azureblobproxydemo
export AZURE_STORAGE_CONTAINER=azure-blob-proxy-demoaz group create \
--name $AZURE_RESOURCE_GROUP \
--location $AZURE_LOCATIONaz storage account create \
--name $AZURE_STORAGE_ACCOUNT \
--resource-group $AZURE_RESOURCE_GROUP \
--location $AZURE_LOCATION \
--sku Standard_ZRSexport AZURE_STORAGE_KEY=$(az storage account keys list --account-name $AZURE_STORAGE_ACCOUNT | jq -r '.[0].value')az storage container create \
--name $AZURE_STORAGE_CONTAINER \
--account-name $AZURE_STORAGE_ACCOUNTecho "Hello, world" > myfile.txtaz storage blob upload \
--account-name $AZURE_STORAGE_ACCOUNT \
--container-name $AZURE_STORAGE_CONTAINER \
--name myfile.txt \
--file myfile.txtaz storage blob list \
--account-name $AZURE_STORAGE_ACCOUNT \
--container-name $AZURE_STORAGE_CONTAINER \
--output tablego run main.gofor i in 1 2 3; do curl 127.0.0.1:8080/myfile.txt; doneyou should see file content
Hello, world
Hello, world
Hello, worldblob (myfile.txt) successfully proxied
{"time":"2024-11-03T07:30:40.548932+08:00","level":"INFO","msg":"serving proxy requests","addr":"127.0.0.1:8080","azure_storage_account":"azureblobproxydemo","container_name":"azure-blob-proxy-demo"}
{"time":"2024-11-03T07:31:11.772515+08:00","level":"INFO","msg":"proxying","blob":"azure-blob-proxy-demo/myfile.txt"}
{"time":"2024-11-03T07:31:12.025935+08:00","level":"INFO","msg":"proxying","blob":"azure-blob-proxy-demo/myfile.txt"}
{"time":"2024-11-03T07:31:12.263774+08:00","level":"INFO","msg":"proxying","blob":"azure-blob-proxy-demo/myfile.txt"}
rm -f myfile.txt
az group delete --name $AZURE_RESOURCE_GROUP
az logoutunset AZURE_LOCATION
unset AZURE_RESOURCE_GROUP
unset AZURE_STORAGE_ACCOUNT
unset AZURE_STORAGE_CONTAINER
unset AZURE_STORAGE_KEY