首页 > 解决方案 > aws-cli create-invalidation 给出签名过期错误

问题描述

我的脚本涉及将文件上传到 s3,然后创建一个失效来刷新内容。

上传到 s3 部分工作正常,但是在创建失效时,我收到了这个错误:

An error occurred (SignatureDoesNotMatch) when calling the CreateInvalidation 
operation: Signature expired: 20190717T012747Z is now earlier than 
20190717T012755Z (20190717T013255Z - 5 min.)

但是 s3 操作有效,所以对我来说为什么云端不起作用是一个难题。

我的脚本是这样的:

# deploy to the s3 bucket
aws s3 sync ./public/. s3://{bucket} --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
# invalidate CF
aws cloudfront create-invalidation --distribution-id {dist_id} --paths /*

我的 IAM 权限设置为CloudFrontFullAccess,即:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "s3:ListAllMyBuckets"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:s3:::*"
        },
        {
            "Action": [
                "acm:ListCertificates",
                "cloudfront:*",
                "iam:ListServerCertificates",
                "waf:ListWebACLs",
                "waf:GetWebACL"
            ],
            "Effect": "Allow",
            "Resource": "*"
        }
    ]
}

标签: bashamazon-web-servicesamazon-cloudfront

解决方案


推荐阅读