如何使用Paws在CloudFront上创建分配

时间:2020-01-05 09:07:32

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

我的目标是使用Paws sdk创建一个基本的CloudFront分发,到目前为止,使用以下配置,我一直无法克服错误400:

use Paws;
use Data::Printer;

my $cloudfront = Paws->service('CloudFront');

my $CreateDistributionResult = $cloudfront->CreateDistribution(
DistributionConfig => {
  CallerReference      => "1578211502",
  Origins => {
    Quantity => 1,
    Items => [{
      DomainName => "foo.s3-website-ap-southeast-2.amazonaws.com",
      Id => 'S3-Website-foo.s3-website-ap-southeast-2.amazonaws.com'}]
  },
  DefaultCacheBehavior => {
    ForwardedValues => {
      Cookies => {Forward => 'none'},
      QueryString => 0
    },
    TargetOriginId => 'S3-Website-foo.s3-website-ap-southeast-2.amazonaws.com',
    TrustedSigners => {
      Enabled  => 0,
      Quantity => 0
    },
    ViewerProtocolPolicy => 'redirect-to-https',
    MinTTL => 0
  },
  Comment              => "",
  Enabled => 1
  });

p $CreateDistributionResult;

以上是api文档herehere中定义的仅必填字段的完整集合。但是,当我运行上面的命令时,它崩溃并显示以下内容:

[foo@bar~]# perl aws.pl
Paws::CloudFront is not stable / supported / entirely developed at /root/perl5/lib/perl5/Paws/CloudFront.pm line 2.
Bad Request

Trace begun at /root/perl5/lib/perl5/Paws/Net/RestXMLResponse.pm line 24
Paws::Net::RestXMLResponse::process('Paws::Net::RestXMLResponse=HASH(0x2f275b8)', 'Paws::CloudFront::CreateDistribution=HASH(0x2fbe6e0)', 'Paws::Net::APIResponse=HASH(0x30c0ec0)') called at /root/perl5/lib/perl5/Paws/Net/Caller.pm line 46
Paws::Net::Caller::caller_to_response('Paws::Net::Caller=HASH(0x16d7bb8)', 'Paws::CloudFront=HASH(0x2a615f8)', 'Paws::CloudFront::CreateDistribution=HASH(0x2fbe6e0)', 'Paws::Net::APIResponse=HASH(0x30c0ec0)') called at /root/perl5/lib/perl5/Paws/Net/RetryCallerRole.pm line 19
Paws::Net::RetryCallerRole::do_call('Paws::Net::Caller=HASH(0x16d7bb8)', 'Paws::CloudFront=HASH(0x2a615f8)', 'Paws::CloudFront::CreateDistribution=HASH(0x2fbe6e0)') called at /root/perl5/lib/perl5/Paws/CloudFront.pm line 49
Paws::CloudFront::CreateDistribution('Paws::CloudFront=HASH(0x2a615f8)', 'DistributionConfig', 'HASH(0x2f9c500)') called at aws.pl line 6

在这里可以正常工作的最小电话是什么?

1 个答案:

答案 0 :(得分:1)

您的comment参数中没有任何内容。请尝试在此处传递值。 AWS对这类事情有点st。另外,请告诉我是否可以解决问题。