gpt4 book ai didi

java - 我在更新现有的 aws cloud front CNAME 时遇到问题

转载 作者:行者123 更新时间:2023-12-02 03:34:09 25 4
gpt4 key购买 nike

我正在尝试以编程方式为 aws cloud front 中的现有分配添加 CNAME。

我尝试了以下代码,但没有给出任何结果。如果有人知道如何以编程方式做到这一点。请好心提及。谢谢您

      AmazonCloudFront cloudFront = AmazonCloudFrontAsyncClientBuilder.standard()
.withRegion(Regions.AP_EAST_1)
.withCredentials(new AWSStaticCredentialsProvider(
new BasicAWSCredentials(route53Manager.getAccessKey(), route53Manager.getSecretKey())))
.build();

GetDistributionConfigResult result = cloudFront.getDistributionConfig(
new GetDistributionConfigRequest("E1EJBNNYJZ6G34"));

Aliases aliases = new Aliases()
.withItems(subDomain)
.withQuantity(1);
DistributionConfig config = result.getDistributionConfig()
.withEnabled(true)
.withAliases(aliases);

最佳答案

您似乎缺少更新分发代码和一些额外的东西。请参阅下面的代码:

AmazonCloudFront cloudFront = AmazonCloudFrontAsyncClientBuilder.standard()
.withRegion(Regions.AP_EAST_1)
.withCredentials(new AWSStaticCredentialsProvider(
new BasicAWSCredentials(route53Manager.getAccessKey(), route53Manager.getSecretKey())))
.build();

//create the request
GetDistributionConfigRequest distributionConfigRequest = new GetDistributionConfigRequest("E1EJBNNYJZ6G34");

//submit the request and get the resulting config
GetDistributionConfigResult distributionConfigResult = cloudFront.getDistributionConfig(distributionConfigRequest);

Aliases aliases = new Aliases()
.withItems(subDomain)
.withQuantity(1);

DistributionConfig config = distributionConfigResult.getDistributionConfig()
.withEnabled(true)
.withAliases(aliases);

//create the update request
UpdateDistributionRequest updateDistributionRequest = new UpdateDistributionRequest(config, distributionConfigRequest.getId(), distributionConfigResult.getETag());

//submit the request to update the config
UpdateDistributionResult updateDistributionResult = cloudfront.updateDistribution(updateDistributionRequest);

//print output of result to console
System.out.println(updateDistributionResult);

关于java - 我在更新现有的 aws cloud front CNAME 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56869535/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com