jordan-wright / ossmalware

MIT License
93 stars 5 forks source link

Switch AWS clients over to a generic cloud client library so it can run on other locations. #8

Closed dlorenc closed 3 years ago

dlorenc commented 3 years ago

I haven't actually tried this out yet, and probably won't be able to on AWS since I don't have an AWS account. I'll get it running on GCP today though.

dlorenc commented 3 years ago

OK, this is working now for GCP. The instructions to setup need to change a bit, the main difference is the environment variables used to access the queue/storage. They basically follow the patterns from here: https://github.com/google/go-cloud

For GCP, you can use something like:

OSSMALWARE_UPLOAD_BUCKET_URL=gs://<gcs bucket name>
OSSMALWARE_QUEUE_URL=gcppubsub://projects/<gcp project id>/subscriptions/<gcp pubsub subscription>

For AWS, it would look like:

OSSMALWARE_UPLOAD_BUCKET_URL=s3://<s3 bucket name>
OSSMALWARE_QUEUE_URL=awssqs://sqs.us-east-2.amazonaws.com/123456789012/myqueue
jordan-wright commented 3 years ago

Also, one more thing: we'll need to update the log line here since it previously pointed to the bucket URL and now points to the bucket object:

2020/11/26 03:35:10 uploading /home/ec2-user/pypi-0-._.-._.-._.-._.-._.-._.-0-0.1.scap to &{%!s(*s3blob.bucket=&{oss-malware-results 0xc00000e168 false}) %!s(*oc.Tracer=&{gocloud.dev/blob gocloud.dev/blob/s3blob 0xc00000e040}) {{%!s(int32=0) %!s(uint32=0)} %!s(uint32=0) %!s(uint32=0) %!s(int32=0) %!s(int32=0)} %!s(bool=false)}/pypi/pypi-0-._.-._.-._.-._.-._.-._.-0-0.1/pypi-0-._.-._.-._.-._.-._.-._.-0-0.1.scap

Otherwise, this seems to work fine on AWS, too, which is great!

dlorenc commented 3 years ago

Ready for another look!

dlorenc commented 3 years ago

All set!