_/\/\____/\/\____/\/\/\/\____/\/\/\/\/\________/\/\_____ _/\/\____/\/\__/\/\____/\/\__/\/\____/\/\____/\/\/\/\___ ___/\/\/\/\____/\/\____/\/\__/\/\/\/\/\____/\/\____/\/\_ _____/\/\______/\/\____/\/\__/\/\__________/\/\/\/\/\/\_ _____/\/\________/\/\/\/\____/\/\__________/\/\____/\/\_ ________________________________________________________
YOPA is Your Own Personal AWS
It allows developers to code without being connected to the net.
Also available as a Docker image.
- SQS service, courtesy of https://github.com/adamw/elasticmq
- S3 service, courtesy of https://github.com/jubos/fake-s3
- SNS service with support for pre-defined and dynamic SQS, HTTP and HTTPS subscriptions. Raw or wrapped deliveries are supported.
- EC2 Metadata service.
-
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).
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
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
Run lein run
to get help.
The following examples assume all the default configuration parameters are used.
aws --endpoint-url http://localhost:47196 sns list-topics
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)
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");
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.