User guide
3. Edit the Source File to Remove the Credentials
4. Transfer the Compiled Program to Your Amazon EC2 Instance
5. Run the Program
Create the Role
The first step is to create an IAM role that has the appropriate permissions.To create the IAM role, follow
the procedure Creating an IAM Role in Using IAM.When you create the IAM role, specify that the trusted
entity is Amazon EC2 and that the role has read access to Amazon S3.
The IAM console provides ready-made policy templates for specific AWS services. When you create the
IAM role, specify the Amazon S3 Read Only Access policy template. The following screen shot from
the IAM role creation wizard shows this policy template.
Policies can also be represented in JSON format. The following JSON block describes the policy for
Amazon S3 Ready Only Access.
{
"Statement": [ {
"Effect": "Allow",
"Action": [
"s3:Get*",
"s3:List*" ],
"Resource": "*"
} ]
}
Note down the name of the role that you create so that you can specify it when you create your Amazon
EC2 Instance in the next step.
Launch an Amazon EC2 Instance with the Corresponding Instance Profile
To create an Amazon EC2 instance, follow the procedure Running an Instance in the Amazon Elastic
Compute Cloud User Guide. We recommend that you specify a recent Windows Server 2008 R2 for
Version v2.0.0
35
AWS SDK for .NET Developer Guide
Walkthrough: Using IAM Roles to Retrieve an Amazon
S3 Object from an Amazon EC2 Instance