繁体   English   中英

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

[英]How to create a distribution on CloudFront using Paws

我的目标是使用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 文档中定义的仅必需字段的完整集合。 但是,当我运行上述内容时,它会崩溃并显示以下内容:

[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

什么是可以在这里工作的正确最小调用?

您在评论参数中没有任何内容。 请尝试在那里传递值。 AWS 对这类事情有点吝啬。 另外请让我知道这是否解决了问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM