使用aws cli json创建云端分发

时间:2015-03-23 19:51:42

标签: json amazon-web-services amazon-cloudfront

您好我正在尝试从aws cli创建一个新的自定义源云端分发。但我收到以下错误。我检查了我的json文件。没有发现错误,但是aws cli正在抛出以下错误

[ec2-user @ ip-172-31-20-146~] $ aws cloudfront create-distribution --distribution-config" $(

这是我的json文件



{
  "DistributionConfig": {
    "CallerReference": "fucking16483256",
    "Aliases": {
      "Quantity": 1,
      "Items": [
        "cdn.nammacloud.com"
      ]
    },
    "Origins": {
      "Quantity": 1,
      "Items": [
        {
          "origin": {
            "CustomOriginConfig": {
              "OriginProtocolPolicy": "match-viewer",
              "HTTPPort": 80,
              "HTTPSPort": 443
            },
            "Id": "Custom-www.nammacloud.com",
            "DomainName": "www.nammacloud.com"
          }
        }
      ]
    },
    "DefaultCacheBehavior": {
      "TargetOriginId": "Custom-www.nammacloud.com",
      "ViewerProtocolPolicy": "allow-all",
      "MinTTL": 3600
    },
    "Comment": "new distribution",
    "Logging": {
      "Bucket": "",
      "Prefix": "",
      "Enabled": false,
      "IncludeCookies": false
    },
    "PriceClass": "PriceClass_All"
  }
}




1 个答案:

答案 0 :(得分:0)

尝试删除包装“DistributionConfig”对象,所以:

{
  "CallerReference": "f***ing16483256",
  "Aliases": {
    "Quantity": 1,
    "Items": [
      "cdn.nammacloud.com"
    ]
  },
  "Origins": {
    "Quantity": 1,
    "Items": [{
      "origin": {
        "CustomOriginConfig": {
          "OriginProtocolPolicy": "match-viewer",
          "HTTPPort": 80,
          "HTTPSPort": 443
        },
        "Id": "Custom-www.nammacloud.com",
        "DomainName": "www.nammacloud.com"
      }
    }]
  },
  "DefaultCacheBehavior": {
    "TargetOriginId": "Custom-www.nammacloud.com",
    "ViewerProtocolPolicy": "allow-all",
    "MinTTL": 3600
  },
  "Comment": "new distribution",
  "Logging": {
    "Bucket": "",
    "Prefix": "",
    "Enabled": false,
    "IncludeCookies": false
  },
  "PriceClass": "PriceClass_All"
}