我正在尝试使用 ember-cli-deploy 和 ember-cli-deploy-cloudfront 将 ember 应用程序部署到 AWS CloudFront。
我在 AWS 中设置了我的存储桶和用户,为我的用户提供了 AmazonS3FullAccess 策略。
将我的.env.deploy.production
文件设置为如下所示:
AWS_KEY=<my key>
AWS_SECRET=<my secret>
PRODUCTION_BUCKET=<app.<my domain>.com
PRODUCTION_REGION=us-east-1
PRODUCTION_DISTRIBUTION=<my cloudfront distribution id>
我的config/default.js
样子是这样的:
/* jshint node: true */
module.exports = function(deployTarget) {
var ENV = {
build: {},
pipeline: {
activateOnDeploy: true
},
s3: {
accessKeyId: process.env.AWS_KEY,
secretAccessKey: process.env.AWS_SECRET,
filePattern: "*"
},
cloudfront: {
accessKeyId: process.env.AWS_KEY,
secretAccessKey: process.env.AWS_SECRET
}
};
if (deployTarget === 'staging') {
ENV.build.environment = 'production';
ENV.s3.bucket = process.env.STAGING_BUCKET;
ENV.s3.region = process.env.STAGING_REGION;
ENV.cloudfront.distribution = process.env.STAGING_DISTRIBUTION;
}
if (deployTarget === 'production') {
ENV.build.environment = 'production';
ENV.s3.bucket = process.env.PRODUCTION_BUCKET;
ENV.s3.region = process.env.PRODUCTION_REGION;
ENV.cloudfront.distribution = process.env.PRODUCTION_DISTRIBUTION;
}
return ENV;
};
我安装了ember-cli-deploy
,ember-cli-deploy-cloudfront
和ember install ember-cli-deploy-aws-pack
.
当我跑ember deploy production
我收到此错误:
AccessDenied: User: arn:aws:iam::299188948670:user/Flybrary is not authorized to perform: cloudfront:CreateInvalidation
我的理解是ember-cli-deploy-cloudfront
为您处理创建失效,但是当我看到这个错误时,我进入 AWS IAM 控制台并自己创建了一个失效。当我尝试运行时,我仍然遇到同样的错误ember deploy production
。