Showing posts with label s3. Show all posts
Showing posts with label s3. Show all posts

Thursday, December 29, 2016

Part 2: Using AWS Simple Email Service (SES) for Inbound Mail


Delete, delete, delete, delete, forward...

In part one of my two part blog on Amazon's Simple Email Service, we set up the necessary resources to receive and process inbound email. In part two, we'll  create a worker that reads an SQS queue and forwards the mail to another email address.

Saturday, December 17, 2016

Using AWS S3 as a Yum Repository

In an earlier post I described how you can use an S3 bucket to host a yum repository.  In this post we'll give the repository a friendlier name and create an index page that's a tad more helpful.  If you're not using AWS S3 and CloudFront to host your static assets, you might want to consider looking into this simple to use solution for running a website without having to manage a webserver.

Visit http://repo.openbedrock.net to see the final product.

Saturday, April 23, 2016

Creating a yum repository using AWS S3 buckets

Here's a short bash script I use to create a yum repo in an S3 bucket.  The script does five (5) things:

  1. creates a local repo in a temporary directory
  2. copies an RPM file to the local repo
  3. creates the yum repository using createrepo
  4. syncs the local directory with the S3 bucket
  5. sets public permissions for the bucket (make sure this is what you actually want to do)
Before you get started create the bucket and configure it to host a static website.  No worries if you don't actually have an index.html.

Create the bucket:


$ aws s3 mb s3://openbedrock-repo

Then configure it to host static files:


$ aws s3 website s3://openbedrock-repo --index-document index.html

Here's the bash script to create the repo:

1:  #!/bin/bash  
2:    
3:   # $ sudo $0 path-to-rpm [bucket]  
4:     
5:   # create a temporary repo  
6:   repo=$(mktemp -d)  
7:   mkdir ${repo}/noarch  
8:   if test -n "$2"; then  
9:    BUCKET="$2"  
10:   else  
11:    BUCKET=openbedrock-repo  
12:   fi  
13:     
14:   # create a temporary local repo and sync with AWS S3 repo  
15:   if test -e "$1"; then  
16:     cp "$1" ${repo}/noarch  
17:     createrepo $repo  
18:   # sync local repo with S3 bucket, make it PUBLIC  
19:     PERMISSION="--grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers"  
20:     aws s3 sync --recursive --include="*" ${repo} s3://$BUCKET/ $PERMISSION  
21:     aws s3 ls s3://$BUCKET/  
22:   # cleanup local copy of repo  
23:     rm -rf $repo  
24:   fi  
25: