Amazon AWS SDK Manuel d'utilisateur Page 19

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 29
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 18
config_file = File.join(File.dirname(__FILE__), "config.yml")
AWS.config(YAML.load(File.read(config_file)))
2. Create a new EC2 instance, specifying the service endpoint as follows:
ec2 = AWS::EC2.new(region: 'us-west-1')
By default, the service endpoint is us-east-1. For a list of Amazon EC2 service endpoints, go to
Regions and Endpoints .
Before running an Amazon EC2 instance, you will need to create an Amazon EC2 security group, authorize
security group ingress, and create a key pair to allow you to log into your instance.
For information about creating a security group, see Create an Amazon EC2 Security Group (p. 16).
For information about authorizing security group ingress, see Authorize Amazon EC2 Security Group
Ingress (p. 17).
For information about creating a key pair, see Create a Key Pair (p. 17).
For information about running your Amazon EC2 instance, see Run an Amazon EC2 Instance (p. 18).
Create a Security Group
Note
This documentation is for the AWS SDK for Ruby version 1, which is a legacy version. For the
most recent version of the SDK for Ruby, see AWS SDK for Ruby - Version 2.
An Amazon EC2 security group controls traffic through your Amazon EC2 instances, much like a firewall.
If you do not create a security group, Amazon EC2 provides a default security group that allows no inbound
traffic. For more information about security groups, go to Security Group Concepts.
If you want to allow inbound traffic, create a security group and assign a rule to it that allows the ingress
that you want.Then associate the new security group with an Amazon EC2 instance. For more information,
see Authorize Security Group Ingress (p. 17).
To create a security group, use the SecurityGroupCollection.create method and pass the name of a
security group you created.The method returns a SecurityGroup object, as follows:
security_group = ec2.security_groups.create('YOUR_SECURITY_GROUP_NAME')
The security group name must be unique within the AWS region in which you initialize your Amazon EC2
client.You must use US-ASCII characters for the security group name and description.
If you attempt to create a security group with the same name as an existing security group, the method
returns an error.
Before starting an Amazon EC2 instance, you next need to authorize security group ingress and create
a key pair to allow you to log into your instance.You can use the returned SecurityGroup object to
authorize or revoke security group ingress and egress.You must also create a key pair to allow you to
log into your instance.
For information about authorizing security group ingress, see Authorize Amazon EC2 Security Group
Ingress (p. 17).
Version v1.0.0
16
AWS SDK for Ruby Developer Guide
Create a Security Group
Vue de la page 18
1 2 ... 14 15 16 17 18 19 20 21 22 23 24 ... 28 29

Commentaires sur ces manuels

Pas de commentaire