Amazon AWS SDK Manual de usuario Pagina 21

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 28
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 20
If you authorize ingress for IP addresses that have already been authorized, the method returns an error.
Whenever you use authorize_ingress or SecurityGroup.authorize_egress, a rule is added to your
security group.You can add up to 100 rules per security group.
For more information about security groups, go to Security Group Concepts.
Create a Key Pair
Public AMI instances have no default password.To log into your Amazon EC2 instance, you must generate
an Amazon EC2 key pair. The key pair consists of a public key and a private key, and is not the same
as your AWS access credentials. For more information about Amazon EC2 key pairs, go to Getting an
SSH Key Pair.
To create a key pair and obtain the private key
1. Use the KeyPairCollection.create method and specify the key pair name. The method returns a
KeyPair object, as follows:
key_pair = ec2.key_pairs.create('YOUR_KEY_PAIR_NAME')
Key pair names must be unique. If you attempt to create a key pair with the same key name as an
existing key pair, an error occurs.
2. Use the returned object's fingerprint property to obtain an SHA-1 digest of the DER-encoded private
key, as follows:
private_key = key_pair.private_key;
Calling create is the only way to obtain the private key programmatically.You can always access
your private key through the AWS Management Console.
Before logging onto an Amazon EC2 instance, you must create the instance and ensure that it is running.
For information about how to run an Amazon EC2 instance, see Run an Amazon EC2 Instance (p. 18).
For information about how to use your key pair to connect to your Amazon EC2 instance, see Connect
to Your Amazon EC2 Instance (p. 19).
Run an Amazon EC2 Instance
Before running an Amazon EC2 instance, ensure that you have created a security group and a key pair
for your instance. For information about creating a key pair, see Create a Key Pair (p. 18). For information
about creating a security group, see Create an Amazon EC2 Security Group (p. 17).
Use the InstanceCollection.create method to run an Amazon EC2 instance. Specify the Amazon Machine
Image (AMI), the instance type, the maximum number of instance to run, the names of a security group
and key pair you created, as follows:
instance = ec2.instances.create(
:image_id => 'ami-11d68a54',
:instance_type => 'm1.small',
:count => 1,
:security_groups => 'YOUR_SECURITY_GROUP_NAME',
:key_pair => ec2.key_pairs['YOUR_KEY_PAIR_NAME'])
Version v1.0.0
18
AWS SDK for Ruby Developer Guide
Create a Key Pair
Vista de pagina 20
1 2 ... 16 17 18 19 20 21 22 23 24 25 26 27 28

Comentarios a estos manuales

Sin comentarios