WordPress & AWS Meetup Talk

Slides from my talk at the June WordPress DC Meetup: AWS & WordPress (PDF).

IAM Policy for W3 Total Cache to use S3 as a CDN and s3fs-fuse as shared storage (don’t use the same bucket for both):

{
    "Statement": [
        {
            "Sid": "",
            "Action": [
                "s3:DeleteObject",
                "s3:Get*",
                "s3:Put*",
                "s3:Set*"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::mybucketname/*"
            ]
        },
        {
            "Sid": "",
            "Action":"s3:List*?",
            "Effect":"Allow",
            "Resource":"*"
        }
    ]
}

/etc/fstab entry for s3fs-fuse with cache on EC2 instance storage. The Amazon Linux AMI automatically mounts the first instance store volume as /media/ephemeral0. See https://github.com/s3fs-fuse/s3fs-fuse/wiki/Fuse-Over-Amazon#details for an important note about unbounded cache growth. max_stat_cache_size=100000 will use about 40 MB of memory.

s3fs#myuploadbucket /var/www/html/wordpress/wp-content/uploads fuse url=https://s3.amazonaws.com,uid=48,gid=48,allow_other,nonempty,use_cache=/media/ephemeral0,max_stat_cache_size=100000,retries=2,readwrite_timeout=5 0 0

Storing PHP sessions in ElastiCache (php.ini):

[Session]
session.save_handler = memcached
session.save_path = "example.abcdef.0001.use1.cache.amazonaws.com:11211"

Leave a Reply

Your email address will not be published.