App-EC2Cssh
view release on metacpan or search on metacpan
scripts/ec2-cssh view on Meta::CPAN
ec2-cssh relies on a configuration files to hold your Amazon AWS EC2 settings, your machine set settings
and the command line to use to ClusterSSH onto your machines.
If no --config option is given, ec2-cssh will look for the following files in order: B<.ec2cssh.conf>, B<$HOME/.ec2cssh.conf>, B</etc/ec2cssh.conf>
=head2 Linux Config example:
In this example, only one instances set 'mytagvalue' defined. This
set will generate all the instances with a tag 'mytag' having a value 'myvalue'
{
'ec2_config' => {
AWSAccessKeyId => '.. Your access Key ID ..',
SecretAccessKey => '.. Your secret access Key ..',
region => 'eu-west-1',
debug => 0,
},
'ec2_sets' => {
'mytagvalue' => {
'Filter' => [
[ 'tag:mytag' , 'myvalue' ],
]
}
},
'command' => q|cssh { join(' ' , map{ '<your username>@'.$_.':22' } @hosts ) }|
}
Then you can do:
$ ec2-ssh -s=mytagvalue
=head2 OSX Config example:
Only the command changes. See Section 'INSTALLING cssh' for more help on
CsshX for Mac OSX.
{
.. Same a Linux. Only this changes: ..
'command' => q|csshX --screen 1 { join(' ' , map{ '<your username>@'.$_.':22' } @hosts ) }|
}
=head1 INSTANCES SET CONFIGURATION
The format of a set configuration follows the following structure:
'set' => {
InstanceId => [ 'instanceID1' , 'instanceID2', ... ],
Filters => [
[ 'Filter name', 'Filter value1' , 'Filter value 2', ... ],
.. Other filters ..
]
}
Both InstanceID and Filters are optional.
See L<http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-DescribeInstances.html> for all available
ways of filtering instances.
=head2 SPLIT CONFIGURATION
Having a config file is fine, but what if you want to keep your credentials secret, and have
your EC2 sets of machine in a .ec2cssh.conf file per projects?
With ec2-cssh, this is possible by splitting the configuration in severl files.
For instance, you can have:
=over
=item .ec2cssh.conf in your project directory:
{
'ec2_config' => { region => 'project-specific-aws-region' },
'ec2_sets' => { 'projectspecificset' => ... },
}
=item $HOME/.ec2cssh.conf:
{
'ec2_config' => { .. Your credentials },
'ec2_sets' => { 'asetilike' => ... }
}
=item /etc/ec2cssh.conf:
{
ec2_sets => { 'asystemwideset' => .. }
command => '.. System wide Cssh command ..'
}
=back
=head2 INSTALLING cssh
=head3 To install cssh on Linux (Debian):
sudo apt-get install clusterssh
TROUBLESHOOTING
If you run system cssh on linux and you have installed this under perlbrew, it is likely you
will run into issues running cssh. This is because cssh is implemented in Perl and even though
it's installed at system level, it will try to lookup its packages in your perlbrew current
environment. The easiest way to work around that is to also install cssh in your current perlbrew.
To do that, run: C<cpanm App::ClusterSSH@4.03_06> (for the latest version)
=head3 To install CsshX for Mac OSX:
brew install csshx
=head1 ABOUT
This code is released under the same licence as Perl5 itself.
Copyright Jerome Eteve (jerome@eteve.net) 2015.
=for HTML <a href="https://travis-ci.org/jeteve/ec2-cssh"><img src="https://travis-ci.org/jeteve/ec2-cssh.svg"></a>
=head1 SEE ALSO
Cluster SSH (Linux) Homepage: L<https://github.com/duncs/clusterssh/wiki>
CsshX (Mac OSX) Homepage: L<https://github.com/brockgr/csshx>
=cut
( run in 0.796 second using v1.01-cache-2.11-cpan-39bf76dae61 )