amazon-web-services 相关问题

关于编程的唯一问题是关于主题的。可以通过https://serverfault.com获取常规服务器帮助。亚马逊网络服务(AWS)是以虚拟化工具为中心的商业服务集合。


如何使用现有Terraform脚本创建新的EC2

现在我想再次运行Terraform脚本以旋转一个新的EC2实例而不删除现有的实例,我该如何完成此操作,需要进行哪些更改?

回答 1 投票 0





DoesAWS OpenSearch支持ML Commons库?

当我在控制台中运行示例代码时,我会收到以下错误消息:

回答 1 投票 0



删除s3

我有一个简单的Terraform代码,我在S3中管理应用程序的版本代码 我想在S3中管理此代码的多个版本。 我的代码如下: main.tf 资源“ aws_s3_bucket&...

回答 1 投票 0

djangodefault_storage可以找到现有文件

我无法弄清楚为什么我不能在代码中使用endists()方法。 我很长一段时间搜索了一个错误,但事实证明,存在()方法总是返回我的错误。

回答 1 投票 0





aws_instance-更改音量_size

即可澄清 - 我只有一个实例。而且我想确保如果需要增加磁盘空间,则不必先销毁机器。弹性(EC2)是我相信它可行的原因。

回答 2 投票 0



<code>func AddCloudFrontBehavior(client *cloudfront.Client, distributionID, originID, pathPattern string) error { distribution, err := client.GetDistributionConfig(context.TODO(), &cloudfront.GetDistributionConfigInput{ Id: aws.String(distributionID), }) if err != nil { return fmt.Errorf("failed to get CloudFront distribution: %v", err) } // Create new behavior newBehavior := cloudfrontTypes.CacheBehavior{ TargetOriginId: aws.String(originID), PathPattern: aws.String(pathPattern), ViewerProtocolPolicy: cloudfrontTypes.ViewerProtocolPolicyAllowAll, AllowedMethods: &cloudfrontTypes.AllowedMethods{ Quantity: aws.Int32(2), Items: []cloudfrontTypes.Method{ cloudfrontTypes.MethodGet, cloudfrontTypes.MethodHead, // cloudfrontTypes.MethodPost, // cloudfrontTypes.MethodPut, // cloudfrontTypes.MethodDelete, // cloudfrontTypes.MethodOptions, // cloudfrontTypes.MethodPatch, }, }, Compress: aws.Bool(true), SmoothStreaming: aws.Bool(false), MinTTL: aws.Int64(0), ForwardedValues: &cloudfrontTypes.ForwardedValues{ QueryString: aws.Bool(false), Cookies: &cloudfrontTypes.CookiePreference{ Forward: cloudfrontTypes.ItemSelectionAll, }, Headers: &cloudfrontTypes.Headers{ Quantity: aws.Int32(0), }, QueryStringCacheKeys: &cloudfrontTypes.QueryStringCacheKeys{ Quantity: aws.Int32(0), }, }, DefaultTTL: aws.Int64(0), MaxTTL: aws.Int64(3600), FieldLevelEncryptionId: aws.String(""), // CachePolicyId: aws.String(originID), // OriginRequestPolicyId: aws.String(originID), } // Append to cache behaviors distribution.DistributionConfig.CacheBehaviors.Items = append(distribution.DistributionConfig.CacheBehaviors.Items, newBehavior) distribution.DistributionConfig.CacheBehaviors.Quantity = aws.Int32(int32(len(distribution.DistributionConfig.CacheBehaviors.Items))) // Update distribution _, err = client.UpdateDistribution(context.TODO(), &cloudfront.UpdateDistributionInput{ Id: aws.String(distributionID), DistributionConfig: distribution.DistributionConfig, IfMatch: distribution.ETag, }) if err != nil { return fmt.Errorf("failed to update CloudFront distribution: %v", err) } fmt.Println("CloudFront behavior added successfully!") return nil }type here </code>

CachedMethods

回答 1 投票 0


最新问题
© www.soinside.com 2019 - 2025. All rights reserved.