Menu
Amazon Mobile Analytics
User Guide

Part 3: Create and Configure an Amazon EC2 Loader Instance

After gathering the details on your Amazon Redshift cluster, you must create and configure your Amazon EC2 loader instance.

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/v2/home.

  2. Ensure that you have created a key pair.

    
							Creating a key pair from the Amazon EC2 console.
  3. Name the key pair.

    
							Naming a key pair in the Amazon EC2 console.
  4. Download the credentials for the key pair.

    
							Signature of a key pair in the Amazon EC2 console.
  5. Choose Instances from the Amazon EC2 console navigation. Then choose Launch Instance and choose Amazon Linux AMI from the list of available AMIs.

    
							Launching an Amazon Linux AMI in the Amazon EC2 console.
  6. Choose the t2.micro instance type.

    
							Selecting the t2micro instance type in the Amazon EC2 console.
  7. Configure your new Amazon EC2 loader instance. Choose a VPC, ideally the VPC you set up in Part 2: Gather Details About the Amazon Redshift Cluster. Choose Enable from the Auto-assign Public IP list. Choose the IAM role you created in Part 1: Configure Security Roles for Auto Export to Amazon Redshift.

    
							Configuring a new Amazon EC2 loader instance in the Amazon EC2 console.
  8. Expand Advanced Details and then copy and paste the following text into the User data section:

    Copy
    #!/bin/bash # Log data to: /var/log/syslog, /var/log/user-data.log, and console output exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 DataExportDir=/home/ec2-user/DataExport yum -y update yum -y install python-pip yum -y install python27 pip install virtualenv virtualenv --python=/usr/bin/python27 $DataExportDir chown -R ec2-user:ec2-user $DataExportDir/ $DataExportDir/bin/pip install -r https://s3.amazonaws.com/awsma-public/AWSMobileAnalyticsDataExport/1.0/latest/requirements.txt https://s3.amazonaws.com/awsma-public/AWSMobileAnalyticsDataExport/1.0/latest/AWSMobileAnalyticsDataExport.tar.gz mkdir $DataExportDir/logs chown -R ec2-user:ec2-user $DataExportDir/ # Get the CloudWatch Logs agent wget https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py
    
							Configuring a new Amazon EC2 loader instance in the Amazon EC2 console.
  9. On Add Storage and Tag Instance tabs, choose Next, accepting their default settings.

  10. On the Configure Security Group tab, configure the Security Group CIDR rule to let your IP addresses connect to the Amazon EC2 instance on port 22. You can use an existing security group instead or change the Source to permit your IP address only.

    
							Configuring the Security Group CIDR rule in the Amazon EC2 console.
  11. Choose Review and Launch the Amazon EC2 instance.

  12. For Select a key pair, choose the key pair you created previously.

    
							Selecting the key pair to use in the Amazon EC2 console for launching a loader for Amazon Redshift.
  13. Choose Launch Instances.

  14. After the Amazon EC2 instance is created, make note of the value for Public DNS, which is required to access the Amazon EC2 instance using SSH or similar tools.

    
							Noting the public DNS value in the Amazon EC2 console for a loader instance used by Amazon Redshift.