2016-01-30 23 views
1

我試圖創建一個新的AWS Cloudfront發行版與v2的AWS AWS的AWS,並不能找出是什麼導致此錯誤。是什麼導致Aws :: CloudFront ::錯誤:: MalformedInput:意外的列表元素終止

AWS :: CloudFront的錯誤:: :: MalformedInput:意外的列表元素終止

client = Aws::CloudFront::Client.new 

    resp = client.create_distribution({ 
     distribution_config: { 
      caller_reference: Time.now.to_i.to_s, 
      :aliases => { 
       :quantity => 1, 
       :items => [Name.generate_name] 
      }, 
      :origins => { 
       :quantity => 1, 
       :items => [ 
        { 
         :id => "#{self.id}-distribution", 
         :domain_name => "example-static.s3-website-us-east-1.amazonaws.com", 
         :origin_path => "/#{self.id}", 
         :custom_headers => { 
          :quantity => 0, 
          :items => [] 
         }, 
         :custom_origin_config => { 
          :http_port => 80, 
          :https_port => 443, 
          :origin_protocol_policy => "http-only", 
          :origin_ssl_protocols => { 
           :quantity => 3, 
           :items => ["TLSv1","TLSv1.1","TLSv1.2"] 
          } 
         } 
        } 
       ] 
      }, 
      :default_cache_behavior => { 
       :target_origin_id => "Custom-example-static.s3-website-us-east-1.amazonaws.com/#{self.id}", 
       :forwarded_values => { 
        :query_string => true, 
        :cookies => { 
         :forward => "none" 
        }, 
        :headers => { 
         :quantity => 1, 
         :items => ["Origin"] 
        } 
       }, 
       :trusted_signers => { 
        :enabled => false, 
        :quantity => 0 
       }, 
       :viewer_protocol_policy => "allow-all", 
       :min_ttl => 0, 
       :allowed_methods => { 
        :quantity => 3, 
        :items => ["HEAD","GET","OPTIONS"], 
        :cached_methods => { 
         :quantity => 3, 
         :items => ["HEAD","GET","OPTIONS"] 
        } 
       }, 
       :smooth_streaming => false, 
       :default_ttl => 86400, 
       :max_ttl => 31536000, 
       :compress => true 
      }, 
      :cache_behaviors => { 
       :quantity => 0 
      }, 
      :custom_error_responses => { 
       :quantity => 0 
      }, 
      :comment => "", 
      logging: { 
       enabled: true, # required 
       include_cookies: false, # required 
       bucket: "example-logs", # required 
       prefix: "#{self.id}", # required 
      },    
      :price_class => "PriceClass_100", 
      :enabled => true, 
      :restrictions => { 
       :geo_restriction => { 
        :restriction_type => "none", 
        :quantity => 0 
       } 
      } 
     } 
      }) 
+0

我沒有看到指定的CertificateSource。 http://docs.aws.amazon.com/AmazonCloudFront/latest/APIReference/CreateDistribution.html#CreateDistribution_Requests – imperalix

+0

這是一個很有意思的想法,但AWS客戶端非常善於分散丟失的元素錯誤。我把這部分放進去,但仍然沒有運氣。 –

回答

3

我比我

client = Aws::CloudFront::Client.new(:http_wire_trace => true) 
resp = client.get_distribution_config({ 
    :id => '<ID>' 
}) 

改變有效載荷得到了現有實例回結果
:custom_headers => { 
    :quantity => 0, 
    :items => [] 
}, 

to

:custom_headers => { 
    :quantity => 0 
}, 

似乎爲我解決了同樣的錯誤信息。

+0

非常感謝。這讓我瘋狂。 –

相關問題