AWS S3 website versioning

匿名 (未验证) 提交于 2019-12-03 01:38:01

问题:

I am running a website on AWS S3 bucket. I have to update the website once in a while. At the moment, when I do the deployment I just copy the built files to my bucket and override existing ones.

Is there a way to do some versioning on these deployments? I know there is a built-in versioning S3, but it is only for individual files I think.

The best option would be that every deployment is tagged with git commit-id and I could rollback to a particular commit-id if needed.

Any ideas? Already tried to name directories with commit-id -prefix, but the problem is that index.html has to live in root dir.

回答1:

You can configure bucket versioning using any of the following methods:

  • Configure versioning using the Amazon S3 console.
  • Configure versioning programmatically using the AWS SDKs

Both the console and the SDKs call the REST API Amazon S3 provides to manage versioning.

Note

If you need to, you can also make the Amazon S3 REST API calls directly from your code. However, this can be cumbersome because it requires you to write code to authenticate your requests.

Each bucket you create has a versioning subresource (see Bucket Configuration Options) associated with it. By default, your bucket is unversioned, and accordingly the versioning subresource stores empty versioning configuration.

<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">  </VersioningConfiguration> 

To enable versioning, you send a request to Amazon S3 with a versioning configuration that includes a status.

<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">    <Status>Enabled</Status>  </VersioningConfiguration> 

To suspend versioning, you set the status value to Suspended.

More information here.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!