amazon-web-services - AWS CLI 创建云前端分发 : --distribution-config

标签 amazon-web-services amazon-cloudfront aws-cli

尝试使用 AWS CLI 进行云前端分发,需要一个参数 --distribution-config

aws cloudfront create-distribution
aws: error: argument --distribution-config is required

我假设这是一个带有分发配置的 json 字符串,但我找不到任何关于它的文档。
我在哪里可以找到一个最小的工作示例?

最佳答案

以下 JSON 对我有用。我使用 get-distribution-config 来生成它。

{
    "Comment": "example json",
    "CacheBehaviors": {
        "Quantity": 0
    },
    "Logging": {
        "Bucket": null,
        "Prefix": null,
        "Enabled": false,
        "IncludeCookies": false
    },
    "Origins": {
        "Items": [
            {
                "S3OriginConfig": {
                    "OriginAccessIdentity": null
                },
                "Id": "S3-origin",
                "DomainName": "example.s3.amazonaws.com"
            }
        ],
        "Quantity": 1
    },
    "DefaultRootObject": null,
    "PriceClass": "PriceClass_All",
    "Enabled": false,
    "DefaultCacheBehavior": {
        "TrustedSigners": {
            "Enabled": false,
            "Quantity": 0
        },
        "TargetOriginId": "S3-origin",
        "ViewerProtocolPolicy": "allow-all",
        "ForwardedValues": {
            "Headers": {
                "Quantity": 0
            },
            "Cookies": {
                "Forward": "none"
            },
            "QueryString": false
        },
        "SmoothStreaming": false,
        "AllowedMethods": {
            "Items": [
                "GET",
                "HEAD"
            ],
            "Quantity": 2
        },
        "MinTTL": 0
    },
    "CallerReference": "example",
    "ViewerCertificate": {
        "CloudFrontDefaultCertificate": true
    },
    "CustomErrorResponses": {
        "Quantity": 0
    },
    "Restrictions": {
        "GeoRestriction": {
            "RestrictionType": "none",
            "Quantity": 0
        }
    },
    "Aliases": {
        "Quantity": 0
    }
}

关于amazon-web-services - AWS CLI 创建云前端分发 : --distribution-config,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26094615/

相关文章:

amazon-web-services - 部署后如何处理云端缓存

javascript - 在 Cloudfront 后面时,.net webforms 站点中缺少 WebResource.axd

amazon-web-services - Powershell Core 的 AWS 工具中的过滤器语法问题

amazon-web-services - AWS WaitCondition 等待配置

amazon-web-services - 如何从另一个账户访问 AWS Athena 表

amazon-web-services - AWS : "Unable to parse certificate. Please ensure the certificate is in PEM format."

amazon-web-services - AWS - 找不到 Cloudfront 堆栈

amazon-web-services - Amazon S3 存储桶策略不支持 "version"选项

ruby-on-rails - 将 Cloudfront 与 Active Storage 结合使用

amazon-web-services - 尝试使用AWS S3 CLI复制一个文件