2015-02-03 2 views
0

저는 DevOps 세계에서 새롭고 회사는 Fog 라이브러리를 사용하여 Dev Environment 용 EC2 인스턴스를 배포합니다. 회사 제품 중 하나에 CDN이 필요하며 동일한 안개 라이브러리를 사용하여 CDN을 자동화하는 방법을 파악하려고합니다.Fog Library를 사용하여 AWS에서 CDN을 만드는 방법

fog.io에서 정보를 찾았으며 여기에 makeCDN.rb (배치 할 .sh 래퍼 사용)에 넣은 코드가 있습니다.

#!/usr/bin/ruby 
require 'fog' 

# create a connection to the service 
cdn = Fog::CDN.new({ 

:provider    => 'AWS', 
:aws_access_key_id  => 'fake_key_id', 
:aws_secret_access_key => '2345fake_access_key6789' 
}) 

cdn.post_distribution({ 
    'CustomOrigin' => { 
    'DNSName'    => 'hostname.domain.org', #example name 
    'HTTPPort'    => '80', 
    'OriginProtocolPolicy' => 'match-viewer', 
    'DefaultRootObject'  => '/', 
    'Enabled'    => 'true', 
    } 

}) 

그래서, 내가 뭘 잘못 확실하지 오전하지만 난 점점 오전 오류입니다 : 나는 정보 here을 발견하지만, 루비 파일에 정보를 분석하는 방법이 확실하지 않은

/home/eztheog/.rvm/gems/[email protected]/gems/excon-0.38.0/lib/excon/middlewares/expects.rb:10:in 
`response_call': Expected(201) <=> Actual(400 Bad Request) (Excon::Errors::BadRequest) 
response => #<Excon::Response:0x00000001d73b78 @data={:body=>"<?xml version=\"1.0\"?>\n<ErrorResponse 
xmlns=\"http://cloudfront.amazonaws.com/doc/2010-11-01/\"><Error> 
<Type>Sender</Type><Code>MalformedXML</Code><Message>1 validation error 
detected: Value null at 'distributionConfig.enabled' failed to satisfy 
constraint: Member must not be null</Message></Error> 
<RequestId>c2b33cda-abee-11e4-8115-b584e1255c70</RequestId> 
</ErrorResponse>", :headers=>{"x-amzn-RequestId"=>"c2b33cda-abee-11e4-8115-b584e1255c70", 
"Content-Type"=>"text/xml", "Content-Length"=>"371", "Date"=>"Tue, 03 
Feb 2015 21:51:07 GMT"}, :status=>400, :remote_ip=>"205.251.242.229", 
:local_port=>39733, :local_address=>"10.100.6.203"}, @body="<?xml 
version=\"1.0\"?>\n<ErrorResponse 
xmlns=\"http://cloudfront.amazonaws.com/doc/2010-11-01/\"><Error> 
<Type>Sender</Type><Code>MalformedXML</Code><Message>1 validation error 
detected: Value null at 'distributionConfig.enabled' failed to satisfy 
constraint: Member must not be null</Message></Error> 
<RequestId>c2b33cda-abee-11e4-8115-b584e1255c70</RequestId> 
</ErrorResponse>", @headers={"x-amzn-RequestId"=>"c2b33cda-abee-11e4- 
8115-b584e1255c70", "Content-Type"=>"text/xml", "Content-Length"=>"371", 
"Date"=>"Tue, 03 Feb 2015 21:51:07 GMT"}, @status=400, 
@remote_ip="205.251.242.229", @local_port=39733, 
@local_address="10.100.6.203"> 

.

어떻게하는지 알아낼 수있는 블로그는 거의없는 것 같습니다.

누구나 올바른 방향을 제시 할 수 있습니까?

답변

1

문맥을 설명하는이 gist을 발견했습니다.

그래서 RubyDoc.info 링크는 Enabled 부울이 옵션이라고 말했습니다. 그러나 AWS에서는 그렇지 않습니다 (또는 내가 가진 오류를 기반으로 한 것처럼 보입니다).

그러나이를 해결하려면 : Enabled => true가 cdn.distribution 블록의 외부에 있어야합니다.

희망이 미래에 이것을 찾는 사람을 돕습니다!

또한 Fog 라이브러리에이 기능이 OPTIONAL이지만 AWS에서는 필수 항목으로 표시되므로 BUG 일 수 있습니다.

관련 문제