GithubHelp home page GithubHelp logo

dogonthehorizon / aws-ddns Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 1.0 53 KB

A small, simple, dynamic dns solution backed by AWS services.

License: BSD 3-Clause "New" or "Revised" License

Makefile 10.11% Haskell 83.37% Shell 6.52%
haskell aws dynamic-dns aws-lambda aws-lambda-haskell

aws-ddns's People

Contributors

dogonthehorizon avatar

Watchers

 avatar  avatar  avatar

Forkers

pdxfoster

aws-ddns's Issues

Validate IP Address when read from S3

Currently just accepting whatever Text value comes from reading form S3. One would probably not want to update a working A record with garbage data if it's avoidable.

-- | Read the IP address out of bucketKey in bucketName.
-- TODO eventually it'll make sense to validate the IP
getIp
:: (MonadAWS m)
=> Text -- ^ The target bucket.
-> Text -- ^ The target key to read from bucket.
-> m Text
getIp bucketName bucketKey = do
val <- send $ getObject (BucketName bucketName) (ObjectKey bucketKey)
toStrict . strip . TE.decodeUtf8 <$> sinkBody (view gorsBody val) sinkLbs

Support file versions in created S3 bucket

AFAICT objects created in S3 are overridden on update. It would be useful if we could add versioning to the bucket so that we could store at least the previous version in case a client sends incorrect data.

Stretch: add support in the Lambda to replace the previous version with the current version if this situation occurs.

Make TTL configurable for A record update

Currently hard-coding a 5 minute TTL. Set this as the default, but not a required value.

Consider a custom ARecordUpdate adt with a smart constructor setting default values.

-- | Update the given A record in the given hosted zone with the given IP.
-- TODO make TTL configurable
-- TODO return something more semantically relevant than the raw AWS response
updateResourceRecordSet
:: (MonadAWS m)
=> Text -- ^ The hosted zone id to change record sets in.
-> Text -- ^ The A record in the hosted zone to update.
-> Text -- ^ The IP address to point our A record to.
-> m ChangeResourceRecordSetsResponse
updateResourceRecordSet hostedZoneId recordSetDomain ipAddress =
send $ changeResourceRecordSets (ResourceId hostedZoneId) $ changeBatch
(consNEmpty $ change Upsert aRecord)
where
aRecord =
resourceRecordSet recordSetDomain A
& (rrsResourceRecords ?~ (consNEmpty . resourceRecord $ ipAddress))
. (rrsTTL ?~ 3600)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.