{"id":19124093,"url":"https://github.com/efforg/aws_one_click_staging","last_synced_at":"2025-07-03T08:06:57.701Z","repository":{"id":66385896,"uuid":"46753261","full_name":"EFForg/aws_one_click_staging","owner":"EFForg","description":null,"archived":false,"fork":false,"pushed_at":"2018-02-22T22:38:18.000Z","size":35,"stargazers_count":4,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-05T19:22:38.380Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EFForg.png","metadata":{"files":{"readme":"README.md","changelog":"changelog","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-23T22:59:15.000Z","updated_at":"2022-06-20T16:04:14.000Z","dependencies_parsed_at":"2023-07-03T06:10:04.627Z","dependency_job_id":null,"html_url":"https://github.com/EFForg/aws_one_click_staging","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/EFForg/aws_one_click_staging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFForg%2Faws_one_click_staging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFForg%2Faws_one_click_staging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFForg%2Faws_one_click_staging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFForg%2Faws_one_click_staging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EFForg","download_url":"https://codeload.github.com/EFForg/aws_one_click_staging/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFForg%2Faws_one_click_staging/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263287847,"owners_count":23443084,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T05:28:07.341Z","updated_at":"2025-07-03T08:06:57.683Z","avatar_url":"https://github.com/EFForg.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AwsOneClickStaging\n\nAwsOneClickStaging is a CLI app that will allow you to create a clone of amazon's S3 bucket (named app_name-staging) and the RDS database (named app_name-staging) so your staging server will be 100% up to date with your production server and allow you to perform some serious testing without the fear of losing important files stored on your S3 bucket.  \n\nIf you didn't already know, S3 is a file storage solution offered by Amazon, and it's not user friendly so you pretty much need to write/ use a script like this in order to setup a staging server.  RDS is Amazon's database storage.  As with all amazon services, RDS databases are in the clown so you can rely on it working well with your app and working hard to provide your users with hilarious service.  \n\n\n## Installation\n\nRun this code (you need ruby) to install:\n\n```ruby\n$  gem install aws_one_click_staging\n```\n\nNext you'll need to setup the config file:\n\n(~/.config/aws_one_click_staging.yml)\n```\naws_access_key_id: \"\"\naws_secret_access_key: \"\"\naws_region: 'us-west-1'\naws_master_user_password: \"\"\naws_production_bucket: \"\" # this bucket is read from\naws_staging_bucket: \"\"    # this bucket is DELETED and written to!\n\ndb_instance_id_production: \"actioncenter\"           # this db_instance is read from\ndb_instance_id_staging: \"actioncenter-staging\"      # this db_instance is DELETED and written to!\ndb_snapshot_id: \"actioncenter-snapshot-for-staging\" # this db snapshot id is OVERWRITTEN\n```\n\n\n## Usage\n\nBecause amazon services are kind of a mess right now, it's best to run this from on an actual Amazon server you have shell access to (it downloads the bucket files and then re-uploads them, lol).\n\n```\naws_one_click_staging stage\n```\n\nAfter a while, the operation will complete and it will say 'congrats' or something and output the RDS url and bucket name for the staging clone.  Plug those values into your staging server and you should be good to go.  \n\n\n## AWS Permissions\n\nBecause you're a professional, you want to grant only the permissions absolutely necessary to the 'staging-bot' user.  \nThat's commendable.  Use the below rules, replacing `PRODUCTIONDB` with the name of your production database/ s3 bucket (hopefully you used the same name for both).  These rules are set via the `Identity \u0026 Access Management` subconsole on amazon.  \n\n(staging-bot-rds-can-do-anything-to-staging-db)\n```\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Sid\": \"Stmt1448499769000\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"rds:*\"\n            ],\n            \"Resource\": [\n                \"arn:aws:rds:*:*:db:PRODUCTIONDB-staging\"\n            ]\n        }\n    ]\n}\n```\n(staging-bot-rds-can-do-anything-to-staging-snapshot)\n```\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Sid\": \"Stmt1448518052000\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"rds:*\"\n            ],\n            \"Resource\": [\n                \"arn:aws:rds:*:*:snapshot:PRODUCTIONDB-snapshot-for-staging\"\n            ]\n        }\n    ]\n}\n```\n(staging-bot-rds-can-snapshot-production-db)\n```\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Sid\": \"Stmt1448517746000\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"rds:CreateDBSnapshot\"\n            ],\n            \"Resource\": [\n                \"arn:aws:rds:*:*:db:PRODUCTIONDB\"\n            ]\n        }\n    ]\n}\n```\n(staging-bot-s3-can-do-anything-to-staging-bucket)\n```\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Sid\": \"Stmt1448518841000\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"s3:*\"\n            ],\n            \"Resource\": [\n                \"arn:aws:s3:::PRODUCTIONDB-staging\",\n                \"arn:aws:s3:::PRODUCTIONDB-staging/*\"\n            ]\n        }\n    ]\n}\n```\n(staging-bot-s3-can-read-from-production-bucket)\n```\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Sid\": \"Stmt1448523618000\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"s3:GetBucketAcl\",\n                \"s3:GetBucketCORS\",\n                \"s3:GetBucketLocation\",\n                \"s3:GetBucketLogging\",\n                \"s3:GetBucketNotification\",\n                \"s3:GetBucketPolicy\",\n                \"s3:GetBucketRequestPayment\",\n                \"s3:GetBucketTagging\",\n                \"s3:GetBucketVersioning\",\n                \"s3:GetBucketWebsite\",\n                \"s3:GetLifecycleConfiguration\",\n                \"s3:GetObject\",\n                \"s3:GetObjectAcl\",\n                \"s3:GetObjectTorrent\",\n                \"s3:GetObjectVersion\",\n                \"s3:GetObjectVersionAcl\",\n                \"s3:GetObjectVersionTorrent\",\n                \"s3:ListAllMyBuckets\",\n                \"s3:ListBucket\",\n                \"s3:ListBucketMultipartUploads\",\n                \"s3:ListBucketVersions\",\n                \"s3:ListMultipartUploadParts\"\n            ],\n            \"Resource\": [\n                \"arn:aws:s3:::PRODUCTIONDB\",\n                \"arn:aws:s3:::PRODUCTIONDB/*\"\n            ]\n        }\n    ]\n}\n```\n\n\n## Development\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n  There's a couple unit tests with commented out method calls.  This was how I tested against amazon, simply uncomment a line, drop in a `binding.pry;exit!` and test/ debug what ever methods you think are messing up.  Also, if you create the file config/aws_actual_fffing_secrets.yml, you can set the config variables that will be used throughout testing...  naturally, ensure such credentials never see the light of github.  \n\n\n## Contributing\n\n1. Fork it ( https://github.com/[my-github-username]/aws_one_click_staging/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n\n## Credits\nCory Forsyth [Bantic](github.com/bantic) wrote the S3 synchronization code used by this gem.  \nrob@eff did the other stuff.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefforg%2Faws_one_click_staging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fefforg%2Faws_one_click_staging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefforg%2Faws_one_click_staging/lists"}