{"id":15568379,"url":"https://github.com/fernandocarletti/capistrano-aws","last_synced_at":"2025-04-15T21:20:17.253Z","repository":{"id":20584177,"uuid":"90340350","full_name":"fernandocarletti/capistrano-aws","owner":"fernandocarletti","description":"Integrates Capistrano with AWS EC2.","archived":false,"fork":false,"pushed_at":"2024-03-14T13:09:12.000Z","size":32,"stargazers_count":16,"open_issues_count":4,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T01:23:50.562Z","etag":null,"topics":["aws","capistrano","ec2"],"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/fernandocarletti.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-05T05:32:38.000Z","updated_at":"2024-05-07T17:05:32.000Z","dependencies_parsed_at":"2022-07-26T09:32:05.121Z","dependency_job_id":null,"html_url":"https://github.com/fernandocarletti/capistrano-aws","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fernandocarletti%2Fcapistrano-aws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fernandocarletti%2Fcapistrano-aws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fernandocarletti%2Fcapistrano-aws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fernandocarletti%2Fcapistrano-aws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fernandocarletti","download_url":"https://codeload.github.com/fernandocarletti/capistrano-aws/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248973284,"owners_count":21191939,"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":["aws","capistrano","ec2"],"created_at":"2024-10-02T17:15:14.575Z","updated_at":"2025-04-15T21:20:17.229Z","avatar_url":"https://github.com/fernandocarletti.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Capistrano AWS [![Gem Version](https://badge.fury.io/rb/capistrano-aws.svg)](https://badge.fury.io/rb/capistrano-aws)\n\nThis gem is slightly based on [cap-ec2](https://github.com/forward3d/cap-ec2), which is not maintained for a while, becoming outdated.\n\nThe purpose of this gem is to provide a flexible and simple integration to AWS EC2, exposing the aws-sdk connection in order to allow any customization.\n\n## Requirements\n\n* Capistrano 3\n\n## Installation\n\nAdd to your `Gemfile` and run `bundler`:\n```ruby\ngem 'capistrano-aws'\n```\n\nOr install the gem system-wide:\n```bash\ngem install capistrano-aws\n```\n\nIn your `Capfile`:\n```ruby\nrequire 'capistrano/aws'\n```\n\n## Configuration\n\n```ruby\n# AWS regions to use.\nset :aws_ec2_regions, ['us-east-1']\n\n# Application name to match application tag.\nset :aws_ec2_application, (proc { fetch(:application) })\n\n# Stage to match stage tag.\nset :aws_ec2_stage, (proc { fetch(:stage) })\n\n# Tag to be used for Capistrano stage.\nset :aws_ec2_stage_tag, 'Stage'\n\n# Tag to be used to match the application.\nset :aws_ec2_application_tag, 'Application'\n\n# Tag to be used for Capistrano roles of the server (the tag value can be a comma separated list).\nset :aws_ec2_roles_tag, 'Roles'\n\n# Extra filters to be used to retrieve the instances. See the README.md for more information.\nset :aws_ec2_extra_filters, []\n\n# Tag to be used as the instance name in the instances table (aws:ec2:instances task).\nset :aws_ec2_name_tag, 'Name'\n\n# How to contact the instance (:public_ip, :public_dns, :private_ip, :private_dns, :id, :ipv_6_address).\nset :aws_ec2_contact_point, :public_ip\n```\n\nThe AWS credentials are loaded from your system. Check https://github.com/aws/aws-sdk-ruby#configuration for more information.\n\n## Usage\n\nThe instances must be registered in each stage. In your `config/deploy/\u003cstage_name\u003e.rb`, add the following line:\n\n*This must be placed after you have configured your AWS settings*\n```ruby\naws_ec2_register\n```\n\nIt will use the instance tags to call the `server` function in capistrano. You can pass a hash as an argument, and it will be merged into the function call:\n\n```ruby\naws_ec2_register user: 'hello', port: 2222\n```\n\n### Custom EC2 Filters\n\nIf you need to identify the instances based on more information, you can specify extra filters to be used in the `filters` option in the [Aws::EC2::Resource.instances](https://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Resource.html#instances-instance_method) call.\n\nImagine you have some split test servers for your production environment, so you can use another tag for specifying the variation of some servers:\n\n| Name      | Application | Environment | Roles  | SplitTestVariation |\n|-----------|-------------|-------------|--------|--------------------|\n| foo-app01 | foo-app     | production  | app,db | 0                  |\n| foo-app02 | foo-app     | production  | app    | 0                  |\n| foo-app03 | foo-app     | production  | app    | 1                  |\n| foo-app04 | foo-app     | production  | app    | 1                  |\n\nIn your environment files:\n\n```ruby\n# production.rb\n\nset :aws_ec2_extra_filters, [\n  {\n    name: \"tag:SplitTestVariation\",\n    values: [\"0\"],\n  },\n]\n```\n\n```ruby\n# production-b.rb\n\nset :aws_ec2_stage, \"production\" # Optional. Use if you have the same environment for the B servers.\nset :aws_ec2_extra_filters, [\n  {\n    name: \"tag:SplitTestVariation\",\n    values: [\"1\"],\n  },\n]\n```\n\nThe `:aws_ec2_stage` variable is needed in order to override the default value of the stage fielter(`:stage`). If you really have a different environment for your `B` servers, you can just use the name of the environment as the file name and remove this line.\n\n## Utility tasks\n\n### aws:ec2:instances\n\nList all the instances found for with the current configuration.\n\n```bash\ncap production aws:ec2:instances\n```\n\n## Contributing\n\nOpen an issue or make a PR, feel free to contribute!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffernandocarletti%2Fcapistrano-aws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffernandocarletti%2Fcapistrano-aws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffernandocarletti%2Fcapistrano-aws/lists"}