Skip to content

Latest commit

 

History

History
128 lines (79 loc) · 4.15 KB

README.md

File metadata and controls

128 lines (79 loc) · 4.15 KB
_/\/\____/\/\____/\/\/\/\____/\/\/\/\/\________/\/\_____
_/\/\____/\/\__/\/\____/\/\__/\/\____/\/\____/\/\/\/\___
___/\/\/\/\____/\/\____/\/\__/\/\/\/\/\____/\/\____/\/\_
_____/\/\______/\/\____/\/\__/\/\__________/\/\/\/\/\/\_
_____/\/\________/\/\/\/\____/\/\__________/\/\____/\/\_
________________________________________________________

YOPA is Your Own Personal AWS

It allows developers to code without being connected to the net.

Build Status
Clojars Project

Also available as a Docker image.

Features

HTTP/S SNS subscriptions

  • The SNS service does not retry HTTP/S failed deliveries.

  • HTTP/S subscriptions are immediately active, whether or not they have been confirmed, this to ease testing applications without having to constantly re-subscribe them.

  • It's possible to manually instruct YOPA to verify an HTTP/S subscription via a custom SNS command:

    curl -v -dAction=VerifySubscription -dSubscriptionArn=<ARN> http://localhost:47196
    

    assuming YOPA SNS is reachable at http://localhost:47196 (replace with whatever hostname and port is relevant for you).

Build and run

Bring the rubygems in with:

mvn -f fake-s3-pom.xml clean initialize

Run the integration tests:

lein test

Run with the example config:

lein trampoline run --config yopa-config-example.yml

Docker container release process

Run the following:

lein clean
mvn -f fake-s3-pom.xml clean initialize
lein uberimage -t unbounce/yopa:latest
sudo docker push unbounce/yopa:latest

Usage

Run lein run to get help.

The following examples assume all the default configuration parameters are used.

AWS CLI

aws --endpoint-url http://localhost:47196 sns list-topics

Ruby

AWS.config(:access_key_id => 'x',
           :secret_access_key => 'x',
           :region => 'yopa-local',
           :use_ssl => false,
           :sqs_endpoint => 'localhost',
           :sqs_port => 47195,
           :sns_endpoint => 'localhost',
           :sns_port => 47196)

JVM

You can either set the endpoints explicitly, like with:

AmazonSNS snsClient = new AmazonSNSClient(awsCredentials);
snsClient.setEndpoint("http://localhost:47196");

Or you can configure the SDK to load the regions override configuration generated by Yopa and get the yopa-local region:

System.setProperty(SDKGlobalConfiguration.REGIONS_FILE_OVERRIDE_SYSTEM_PROPERTY, "/tmp/aws-regions-override.xml");
Region region = RegionUtils.getRegion("yopa-local");

and then either set the region on the client, while forcing the client to use HTTP:

AmazonSNS snsClient = new AmazonSNSClient(awsCredentials, new ClientConfiguration().withProtocol(Protocol.HTTP));
snsClient.setRegion(region);

or derive the endpoint from the region:

AmazonSNS snsClient = new AmazonSNSClient(awsCredentials);
snsClient.setEndpoint("http://" + region.getServiceEndpoint("sns"));

To use the EC2 Metadata service, set the SDK overriding property to point to Yopa's SNS port, using the /ec2-metadata path:

System.setProperty(SDKGlobalConfiguration.EC2_METADATA_SERVICE_OVERRIDE_SYSTEM_PROPERTY, "http://0.0.0.0:47196/ec2-metadata");

Accessing S3

Using Yopa's S3 service requires setting the S3 client to use the forced path style. Check out this detailed clients guide to see how to do it for your platform.

Note that Yopa can be configured to create buckets with non-DNS compliant names, which is enough for automatically triggering the use of the forced path style in the Java AWS SDK. In that case it is enough to use setEndpoint() to configure the S3 client.