Step 2: Configure your Amazon EC2 instance
When your Amazon EC2 instance is available, you can log into it and prepare it for first use.
Note
The following steps assume that you're connecting to your Amazon EC2 instance from a computer running Linux. For other ways to connect, see Connect to your Linux instance in the Amazon EC2 User Guide.
To configure your Amazon EC2 instance
-
You need to authorize inbound SSH traffic to your Amazon EC2 instance. To do this, create a new EC2 security group, and then assign the security group to your EC2 instance.
-
In the navigation pane, choose Security Groups.
-
Choose Create Security Group. In the Create Security Group window, do the following:
-
Security group name – Enter a name for your security group. For example:
my-ssh-access -
Description – Enter a short description for the security group.
-
VPC – Choose your default VPC.
-
In the Inbound rules section, choose Add Rule and do the following:
-
Type – Choose SSH.
-
Source – Choose My IP.
-
Choose Add rule.
-
On the bottom of the page, confirm the configuration settings and choose Create Security Group.
-
-
In the navigation pane, choose Instances.
-
Choose the Amazon EC2 instance that you launched in Step 1: Launch an Amazon EC2 instance.
-
Choose Actions, choose Security, and then choose Change Security Groups.
-
In Change Security Groups, go to Associated security groups and enter the security group that you created earlier in this procedure (for example,
my-ssh-access). The existingdefaultsecurity group should also be selected. Confirm the configuration settings and choose Save.
-
-
Use the following command to protect your private key file from access. If you skip this step, the connection fails.
chmod 400path_to_file/my-keypair.pem -
Use the
sshcommand to log in to your Amazon EC2 instance, as in the following example.ssh -ipath_to_file/my-keypair.pemubuntu@public-dns-nameYou need to specify your private key file (.pem file) and the public DNS name of your instance. (See Step 1: Launch an Amazon EC2 instance).
The login ID is
ubuntu. No password is required.For more information about allowing connections to your Amazon EC2 instance and for AWS CLI instructions, see Authorize inbound traffic for your Linux instances in the Amazon EC2 User Guide.
-
Download and install the latest version of the AWS Command Line Interface.
-
Install
unzip.sudo apt install unzip -
Download the
zipfile with the AWS CLI.curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" -
Unzip the file.
unzip awscliv2.zip -
Install the AWS CLI.
sudo ./aws/install -
Confirm the version of the AWS CLI installation.
aws --versionThe output should look like this:
aws-cli/2.9.19 Python/3.9.11 Linux/5.15.0-1028-aws exe/x86_64.ubuntu.22 prompt/off
-
-
Configure your AWS credentials, as shown in the following example. Enter your AWS access key ID, secret key, and default Region name when prompted.
aws configureAWS Access Key ID [None]:AKIAIOSFODNN7EXAMPLEAWS Secret Access Key [None]:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEYDefault region name [None]:us-east-1Default output format [None]: Add rules to your VPCs security group that allow inbound HTTP, HTTPS, and SSH access from IPv6 addresses.
-
To confirm that your VPC endpoint has been configured correctly, you have to use a
cqlshconnection to Amazon Keyspaces. If you use your local environment or the Amazon Keyspaces CQL editor in the AWS Management Console, the connection automatically goes through the public endpoint instead of your VPC endpoint. To usecqlshto test your VPC endpoint connection in this tutorial, complete the setup instructions in Using cqlsh to connect to Amazon Keyspaces.
You are now ready to create a dual-stack VPC endpoint for Amazon Keyspaces.