The Leading Cloud Operations Optimization Service
US Toll Free(800) 505-9638
  • CUSTOMERS
  • BLOG
  • CONTACT
  • LOGIN
  • SIGN UP
  • CUSTOMERS
  • BLOG
  • CONTACT
  • LOGIN
  • SIGN UP
  • CUSTOMERS
  • BLOG
  • CONTACT
  • LOGIN
  • SIGN UP
  • AWS RESELLERS
  • SOLUTIONS
    • Newvem for AWS
      • How it Works
      • Utilization Heat Map
      • Business Views of AWS
      • Cloud Baseline
        • Assets
        • Costs
        • Risks
      • AWS Support
        • Support Center
        • Community Forums
        • Knowledge Center
          • How-to Guides
          • Community Articles
          • Amazon Cloud Computing Services
          • AWS Cloud Support
          • AWS Reserved Instances
          • AWS Console
          • AWS EC2
          • Amazon Elastic Compute Cloud
          • EC2 Instances
          • Understanding Amazon AMI
        • Proficiency Level
          • Beginner
          • Advanced
          • Professional
        • Cloud Partners
        • Cloud Experts
      • Cloud Insight by Topic
        • Capacity
        • Utilization
        • Availability
        • Security
        • Financial Efficiency
      • Advanced Analytic Tools
        • Baseline Insights
        • Premium Insights
        • Business Groups
        • Reserved Instances
        • S3 Analytics
      • Cloud Baseline by Role
        • C-Level Cockpit
        • IT Managers View
        • Operators View
        • Developers View
      • Cloud Insight by AWS Service
        • Amazon EC2
        • Amazon S3
      • iPhone / iPad App
    • Newvem for Azure
      • Azure Beta Program
      • Knowledge Center
  • FEATURES
    • Free Cloud Care Features
    • Premium Cloud Care Features
  • PRICING
  • AZURE BETA
  • AWS RESELLERS
  • SOLUTIONS
    • Newvem for AWS
      • How it Works
      • Utilization Heat Map
      • Business Views of AWS
      • Cloud Baseline
        • Assets
        • Costs
        • Risks
      • AWS Support
        • Support Center
        • Community Forums
        • Knowledge Center
          • How-to Guides
          • Community Articles
          • Amazon Cloud Computing Services
          • AWS Cloud Support
          • AWS Reserved Instances
          • AWS Console
          • AWS EC2
          • Amazon Elastic Compute Cloud
          • EC2 Instances
          • Understanding Amazon AMI
        • Proficiency Level
          • Beginner
          • Advanced
          • Professional
        • Cloud Partners
        • Cloud Experts
      • Cloud Insight by Topic
        • Capacity
        • Utilization
        • Availability
        • Security
        • Financial Efficiency
      • Advanced Analytic Tools
        • Baseline Insights
        • Premium Insights
        • Business Groups
        • Reserved Instances
        • S3 Analytics
      • Cloud Baseline by Role
        • C-Level Cockpit
        • IT Managers View
        • Operators View
        • Developers View
      • Cloud Insight by AWS Service
        • Amazon EC2
        • Amazon S3
      • iPhone / iPad App
    • Newvem for Azure
      • Azure Beta Program
      • Knowledge Center
  • FEATURES
    • Free Cloud Care Features
    • Premium Cloud Care Features
  • PRICING
  • AZURE BETA
  • AWS RESELLERS
  • SOLUTIONS
    • Newvem for AWS
      • How it Works
      • Utilization Heat Map
      • Business Views of AWS
      • Cloud Baseline
        • Assets
        • Costs
        • Risks
      • AWS Support
        • Support Center
        • Community Forums
        • Knowledge Center
          • How-to Guides
          • Community Articles
          • Amazon Cloud Computing Services
          • AWS Cloud Support
          • AWS Reserved Instances
          • AWS Console
          • AWS EC2
          • Amazon Elastic Compute Cloud
          • EC2 Instances
          • Understanding Amazon AMI
        • Proficiency Level
          • Beginner
          • Advanced
          • Professional
        • Cloud Partners
        • Cloud Experts
      • Cloud Insight by Topic
        • Capacity
        • Utilization
        • Availability
        • Security
        • Financial Efficiency
      • Advanced Analytic Tools
        • Baseline Insights
        • Premium Insights
        • Business Groups
        • Reserved Instances
        • S3 Analytics
      • Cloud Baseline by Role
        • C-Level Cockpit
        • IT Managers View
        • Operators View
        • Developers View
      • Cloud Insight by AWS Service
        • Amazon EC2
        • Amazon S3
      • iPhone / iPad App
    • Newvem for Azure
      • Azure Beta Program
      • Knowledge Center
  • FEATURES
    • Free Cloud Care Features
    • Premium Cloud Care Features
  • PRICING
  • AZURE BETA
  • Newvem for AWS
  • Cloud Care Features
  • Newvem for Azure

Modifying the Application

Subscribe to Our Weekly Newsletter
Submit

You are now subscribed!



Watch Newvem's Video
Sign Up for FREE

Most Popular Posts

  • Are You an AWS Cloud Expert? Find Out Now!
  • What’s CPU Steal Time?
  • Dissecting Amazon Elastic Load Balancer (ELB): 18 Facts You Should Know
  • The 10 Most Common Amazon’s AWS Usage Mistakes
  • The 5 Biggest Security Mistakes Users Make in Amazon’s Cloud

Tags

Amazon Cloud Services AWS Cloud Backup Best Practices Cloud Capacity CloudFront CloudWatch Consumption Cost Efficiency EBS EC2 ELB High Availability How-to Guide IAM Management and Control S3 Security Security Groups Utilization

Home»
AWS
»AWS Getting Started Guide
»Modifying the Application

Modifying the Application

We are now ready to modify the application in order to publish our images to Amazon S3 automatically. We will also use Amazon RDS to index our content which is stored in Amazon S3.

Note: We will be modifying the code from the web server, so that the webmaster’s S3 credentials are not exposed to end users.

We will be modifying the application in the following ways:

  • Updating your web.config file
  • Modifying your code so that it points to your Amazon CloudFront distribution or Amazon S3 bucket
  • Modifying your code so that it points to your Amazon RDS file

 Here’s the procedure to update your web.config file:

  • Open the web.config file, and replace the text that says “Enter your access/secret key here” with the actual values. 

<appSettings>

<add key=”PublicKey” value=”Enter your access key here”/>

<add key=”SecretKey” value=”Enter your secret key here”/>

</appSettings>

Note: In production, we would always encrypt web.config, but that would be out of scope   for this tutorial exercise. Furthermore, it is always a good practice to use one’s AWS Identity and Access Management (IAM) user accounts, instead of the master credentials.

Here is the procedure to modify the code so that it points to your Amazon CloudFront distribution or Amazon S3 bucket:

  • Open “default.aspx.cs” on your Amazon EC2 instance, and replace “http://your-non-dotted-bucket-name.s3.amazonaws.com/” with the name of your Amazon CloudFront distribution or Amazon S3 bucket. (For ex: In the section Creating a CloudFront Distribution, our Amazon CloudFront distribution is d18k4jybr69gw2.cloudfront.net.)

 default.aspx - 1

  • Open “default.aspx.cs” and replace “your-non-dotted-bucket-name” with the name of your Amazon S3 bucket. “For ex: In the section Creating an Amazon S3 Bucket, our Amazon S3 bucket is webapplication.)

Note: You should ensure that you don’t forget the trailing slash for your Amazon S3 bucket or your Amazon CloudFront distribution.

public partial class _Default : System.Web.UI.Page

{

public string PhotoGalleryBaseUrl = “http://d18k4jybr69gw2.cloudfront.net/”;

…

private const string ImageBucketName = “webapplication”;

}

If you had skipped creating the CloudFront distribution, you will have to enter your          Amazon S3 bucket, as shown in the following example:

public partial class _Default : System.Web.UI.Page

{

public string PhotoGalleryBaseUrl = “http://webapplication.s3.amazon

aws.com/”;

…

private const string ImageBucketName = “webapplication”;

}

Note: This code will publish images to your Amazon S3 bucket and set the permissions on each file to be public (readable by everyone).

Here’s the procedure to modify the code so that it points to your Amazon RDS database:

  • Open “default.aspx.cs” and replace the text for the following variables with the actual values. These values are used to build your connection string using MySQL Connector/.NET.
    • Database endpoint
    • Database master user ID
    • Database master password
    • Database name

modify the code so that it points to your Amazon RDS database - 2 

public partial class _Default : System.Web.UI.Page

{

private string dbinstance = “mydbinstance.cgwxy4t1e0xb.us-east-

1.rds.amazonaws.com”;

private string userid =”awsuser”;

private string password =”mypassword”;

private string database =”mydb”;

}

It is time to deploy your sample website now.

Follow these steps to restart your website:

  • Navigate to “Default Web Site” in the IIS Manager, and right-click on it.
  • Select “Manage Web Site” and click on “Restart”.
  • Find the DNS address of the load balancer:
    • In the AWS Management Console, click on the “Amazon EC2” tab.
    • In the “Navigation” pane, click on “Load Balancers”.
    • In the “Load Balancers” pane, click on “MyLB”, and note the public DNS in the bottom pane.

Find the DNS address of the load balancer - 3

    • Now, you need to type the DNS address of the load balancer in your web browser to verify that your application is still working.
    • There are no images in the current Amazon RDS database, and so there will be no images seen. You should upload images (less than or equal to 4 MB) to the website, and check whether they are being displayed correctly.

Note: You may not be connected to your Amazon RDS database if you’re having trouble in displaying the images. Ensure that you’ve typed your Amazon EC2 security group correctly while authorizing access for the database security group. You should try to re-authorize your Amazon EC2 security group if the problem persists.

Congratulations! You have been successful in deploying a sample web application using Amazon Web Services. Now, if you decide you want to launch more instances in the future, there is no need to customize each one.

Let us now move on, and create a custom Amazon Machine Image (AMI) with all the configuration changes we’ve just made.

 

Subscribe to Our Weekly Newsletter
Submit

You are now subscribed!



Watch Newvem's Video
Sign Up for FREE

Most Popular Posts

  • Are You an AWS Cloud Expert? Find Out Now!
  • What’s CPU Steal Time?
  • Dissecting Amazon Elastic Load Balancer (ELB): 18 Facts You Should Know
  • The 10 Most Common Amazon’s AWS Usage Mistakes
  • The 5 Biggest Security Mistakes Users Make in Amazon’s Cloud

Tags

Amazon Cloud Services AWS Cloud Backup Best Practices Cloud Capacity CloudFront CloudWatch Consumption Cost Efficiency EBS EC2 ELB High Availability How-to Guide IAM Management and Control S3 Security Security Groups Utilization

Top
12

2021 Hot Cloud
Computing Company

Company

  • About Newvem
  • On Bloomberg TV
  • Profit from the Cloud
  • In the News
  • Our Team
  • Jobs
  • Our Clients
  • Press Release
  • Terms of Use
  • Privacy Policy
  • White Paper

Hot Topics

  • Cloud Smart Meter
  • AWS Infographic
  • Reserved Instance Marketplace
  • 10 AWS Usage Mistakes
  • 5 AWS Security Mistakes
  • AWS Usage Tips
  • Amazon S3 Analytics

Solutions

  • Cloud Smart Meter App
  • AWS Reserved Instances Calculator
  • S3 Analytic Tool
  • How It Works
  • How to Get Started
  • AWS Support
  • C-Level View
  • IT Manager View
  • Cloud Operator View
  • Developer View
  • AWS cloud for the enterprise
  • Analytics for Azure

CloudPedia

  • CloudPedia
  • Cloud Radar
  • AWS Getting Started Guide
  • Prepare for AWS Outages
  • Best Practice Insights
  • Effective AWS EC2
  • AWS Financial Efficiency
  • AWS Availability
  • AWS Security
  • AWS Training
  • AWS Usage Tips

Contact Us

  • Support
  • Contact Us

Stay connected

© 2020 - 2022. Newvem Insight Ltd. All Rights Reserved.