承接 craftcms/aws-s3 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

craftcms/aws-s3

Composer 安装命令:

composer require craftcms/aws-s3

包简介

Amazon S3 integration for Craft CMS

README 文档

README

Amazon S3 for Craft CMS icon

Amazon S3 for Craft CMS

This plugin provides an Amazon S3 integration for Craft CMS.

Requirements

This plugin requires Craft CMS 4.0.0+ or 5.0.0+.

Installation

You can install this plugin from the Plugin Store or with Composer.

From the Plugin Store

Go to the Plugin Store in your project’s Control Panel and search for “Amazon S3”. Then press Install in its modal window.

With Composer

Open your terminal and run the following commands:

# go to the project directory
cd /path/to/my-project.test

# tell Composer to load the plugin
composer require craftcms/aws-s3

# tell Craft to install the plugin
./craft plugin/install aws-s3

Setup

To create a new Amazon S3 filesystem to use with your volumes, visit SettingsFilesystems, and press New filesystem. Select “Amazon S3” for the Filesystem Type setting and configure as needed.

💡 The Base URL, Access Key ID, Secret Access Key, Bucket, Region, Subfolder, CloudFront Distribution ID, and CloudFront Path Prefix settings can be set to environment variables. See Environmental Configuration in the Craft docs to learn more about that.

AWS IAM Permissions

Setting up IAM permissions for use with this plugin differs from what options you want to be available.

Generally, you'll want an IAM policy that grants the following actions on the resource(s) that you'll use:

  • s3:GetBucketLocation
  • s3:ListBucket
  • s3:PutObject
  • s3:GetObject
  • s3:DeleteObject
  • s3:GetObjectAcl
  • s3:PutObjectAcl

If you want to allow the site administrator to list and select the bucket to use, you'll also have to add the s3:ListAllMyBuckets permission to the arn:aws:s3::: resource and the s3:GetBucketLocation permission to the specific bucket resource. Please note, that if a bucket lacks the s3:GetBucketLocation permission, it will not appear in the bucket selection list.

If you use Cloudfront and would like Craft to invalidate files on your behalf you'll also need the following permissions:

  • cloudfront:ListInvalidations
  • cloudfront:GetInvalidation
  • cloudfront:CreateInvalidation

A typical IAM policy that grants the user to choose a bucket can look like this:

{
"Version": "2012-10-17",
"Statement": [
    {
        "Effect": "Allow",
        "Action": [
            "s3:ListAllMyBuckets"
        ],
        "Resource": "*"
    },
    {
        "Effect": "Allow",
        "Action": [
            "s3:GetBucketLocation",
            "s3:ListBucket",
            "s3:PutObject",
            "s3:GetObject",
            "s3:DeleteObject",
            "s3:GetObjectAcl",
            "s3:PutObjectAcl",
            "cloudfront:ListInvalidations",
            "cloudfront:GetInvalidation",
            "cloudfront:CreateInvalidation"
        ],
        "Resource": [
            "arn:aws:s3:::bucketname/*",
            "arn:aws:cloudfront::accountid:distribution/distributionid"
        ]
    },
    {
        "Effect": "Allow",
        "Action": [
            "s3:GetBucketLocation",
            "s3:ListBucket"
        ],
        "Resource": [
            "arn:aws:s3:::bucketname"
        ]
    }
]
}

Using automatic focal point detection

This plugin can use the AWS Rekognition service to detect faces in an image and automatically set the focal point accordingly. This requires the image to be either a jpg or a png file. You can enable this feature via Attempt to set the focal point automatically? in the filesystem settings.

⚠️ ️Using this will incur extra cost for each upload, and requires the rekognition:DetectFaces action to be allowed.

Assuming Role with OIDC

This plugin also has the ability to assume a role provided to the runtime with the AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_ARN environment variables. If you provide no credentials to AWS and these environment variables exist, then the plugin will attempt to create a connection to AWS using the CredentialProvider::assumeRoleWithWebIdentityCredentialProvider. This is the ideal way to allow fine-grained access control for hosting Craft CMS in Kubernetes (for example). See the IAM documentation on AWS for more details.

Tasks running in ECS

This plugin is compatible with IAM roles for ECS tasks and will automatically use the AWS_CONTAINER_CREDENTIALS_RELATIVE_URI environment variable, if it’s available. See the IAM Roles for Tasks documentation on AWS for more details.

craftcms/aws-s3 适用场景与选型建议

craftcms/aws-s3 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.54M 次下载、GitHub Stars 达 63, 最近一次更新时间为 2017 年 01 月 31 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「s3」 「cms」 「aws」 「yii2」 「Flysystem」 「craftcms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 craftcms/aws-s3 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 craftcms/aws-s3 我们能提供哪些服务?
定制开发 / 二次开发

基于 craftcms/aws-s3 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.54M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 64
  • 点击次数: 24
  • 依赖项目数: 27
  • 推荐数: 0

GitHub 信息

  • Stars: 63
  • Watchers: 5
  • Forks: 31
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-31