官术网_书友最值得收藏!

Hierarchical storage management

S3 can be configured to use global or local buckets. Investigate your latency requirements before choosing the global option. You can use replication to synchronize your objects across regions if eventual consistency is acceptable—the following code sample shows how this might be achieved, but should not be used verbatim:

{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:GetReplicationConfiguration",
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": [
"${aws_s3_bucket.bucket.arn}"
]
},
-----------------------------------------------------------------------

resource "aws_iam_policy_attachment" "replication" {
name = "tf-iam-role-attachment-replication-12345"
roles = ["${aws_iam_role.replication.name}"]
policy_arn = "${aws_iam_policy.replication.arn}"
}

resource "aws_s3_bucket" "destination" {
bucket = "tf-test-bucket-destination-12345"
region = "us-west-1"

versioning {
enabled = true
}
}
-----------------------------------------------------------------------

replication_configuration {
role = "${aws_iam_role.replication.arn}"

rules {
id = "foobar"
prefix = "foo"
status = "Enabled"

destination {
bucket = "${aws_s3_bucket.destination.arn}"
storage_class = "STANDARD"
}
}
}
}
The complete version of the preceding code block can be found in the GitHub page:  https://github.com/PacktPublishing/Implementing-Cloud-Design-Patterns-for-AWS-Second-Edition/tree/master/Chapter03.

Storage life cycle policies can also be attached to your buckets, which will move infrequently accessed object to less available and more inexpensive storage:

resource "aws_s3_bucket" "versioning_bucket" {
bucket = "my-versioning-bucket"
acl = "private"

versioning {
enabled = true
}

lifecycle_rule {
prefix = "config/"
enabled = true
noncurrent_version_transition {
days = 30
storage_class = "STANDARD_IA"
}

noncurrent_version_transition {
days = 60
storage_class = "GLACIER"
}

noncurrent_version_expiration {
days = 90
}
}
}
Remember that, even though read speeds and bandwidth decrease with lower storage classes, object durability remains very high (such as ten nines).

主站蜘蛛池模板: 垫江县| 沧源| 宜君县| 双峰县| 太康县| 虹口区| 吴江市| 淮南市| 巩留县| 比如县| 开阳县| 舟山市| 咸阳市| 偃师市| 咸丰县| 五原县| 锦屏县| 朔州市| 黄山市| 延安市| 商水县| 孟连| 都匀市| 武夷山市| 渭南市| 台北县| 射阳县| 布拖县| 若羌县| 长子县| 台中县| 长海县| 余姚市| 石城县| 叙永县| 威宁| 拜城县| 奎屯市| 石棉县| 秦安县| 渭南市|