Skip to content

Tool that converts Amazon S3 redirection rules from human readable text format to valid XML ready to be inserted to AWS Console

License

Notifications You must be signed in to change notification settings

sukharevd/s3routes

Repository files navigation

s3routes

It's possible to define rules that describe to where client should be redirected when it access some, specified object within Amazon S3 bucket.

This project represents a tool that does one simple thing - it converts that redirection rules from human readable text format to valid XML.

For instance having plain text routing rules

former.php                         new.html
former-directory/                  new-directory/
internal/page.html                 http://external.domain.com/index.html

this tool can give you valid XML ready to be inserted to AWS Console

<?xml version="1.0"?>
<RoutingRules>
    <RoutingRule>
        <Condition>
            <KeyPrefixEquals>former.php</KeyPrefixEquals>
        </Condition>
        <Redirect>
            <ReplaceKeyPrefixWith>new.html</ReplaceKeyPrefixWith>
        </Redirect>
    </RoutingRule>
    <RoutingRule>
        <Condition>
            <KeyPrefixEquals>former-directory/</KeyPrefixEquals>
        </Condition>
        <Redirect>
            <ReplaceKeyPrefixWith>new-directory/</ReplaceKeyPrefixWith>
        </Redirect>
    </RoutingRule>
    <RoutingRule>
        <Condition>
            <KeyPrefixEquals>internal/page.html</KeyPrefixEquals>
        </Condition>
        <Redirect>
            <HostName>external.domain.com</HostName>
            <Protocol>http</Protocol>
            <ReplaceKeyPrefixWith>index.html</ReplaceKeyPrefixWith>
        </Redirect>
    </RoutingRule>
</RoutingRules>

The project is a part of article Generating routing rules for Amazon S3 bucket.

##Demo Application is available online here.

About

Tool that converts Amazon S3 redirection rules from human readable text format to valid XML ready to be inserted to AWS Console

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages