Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4267848
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:57:19+00:00 2026-05-21T06:57:19+00:00

I’ve tried everything here, but the Amazon Load Balancer API just will not accept

  • 0

I’ve tried everything here, but the Amazon Load Balancer API just will not accept my signature.

Whatever I try, I get a “403 SignatureDoesNotMatch” response. I’m probably missing something obvious, but having spent hours trying to figure out what that is, I’m at the end of my tether. Please help!! Thanks.

Here’s my code:

Public Sub DeregisterInstanceFromLoadBalance(ByVal strServerID As String)
    Dim strURL As String
    strURL = "http://elasticloadbalancing.amazonaws.com/?"
    Dim strTimestamp As String = PercentEncodeRfc3986(DateTime.UtcNow.ToString("yyyy-MM-dd'T'HH:mm:ss'Z'"))

    Dim strParams As String
    strParams = "AWSAccessKeyId=<MY_API_KEY>" & _
    "&Action=DeregisterInstancesFromLoadBalancer" & _
    "&Instances.member.N=" & strServerID & _
    "&LoadBalancerName=ATTB" & _
    "&SignatureMethod=HmacSHA256" & _
    "&SignatureVersion=2" & _
    "&Timestamp=" & strTimestamp & _
    "&Version=2009-05-15"

    Dim strStringToSign As String = "GET\nelasticloadbalancing.amazonaws.com\n/\n" & strParams

    strURL = strURL & strParams & "&Signature=" & PercentEncodeRfc3986(HashString(strStringToSign))

    Dim wc As New WebClient()
    Dim strResponse As String
    strResponse = wc.DownloadString(strURL)

End Sub


Private Const PRIVATE_KEY As String = "<MY_PRIVATE_KEY>"

Private Function HashString(ByVal StringToHash As String) As String
    Dim Key() As Byte = Encoding.UTF8.GetBytes(PRIVATE_KEY)
    Dim XML() As Byte = Encoding.UTF8.GetBytes(StringToHash)
    Dim myHMACSHA256 As New System.Security.Cryptography.HMACSHA256(Key)
    Dim HashCode As Byte() = myHMACSHA256.ComputeHash(XML)
    Return Convert.ToBase64String(HashCode)
End Function


Private Function PercentEncodeRfc3986(ByVal str As String) As String

    str = HttpUtility.UrlEncode(str, System.Text.Encoding.UTF8)
    str = str.Replace("'", "%27").Replace("(", "%28").Replace(")", "%29").Replace("*", "%2A").Replace("!", "%21").Replace("%7e", "~").Replace("+", "%20").Replace("%7E", "~")

    Dim sbuilder As StringBuilder = New StringBuilder(str)
    For i As Int32 = 0 To sbuilder.Length - 1

        If sbuilder(i) = "%" Then
            If (Char.IsLetter(sbuilder(i + 1)) OrElse Char.IsLetter(sbuilder(i + 2))) Then
                sbuilder(i + 1) = Char.ToUpper(sbuilder(i + 1))
                sbuilder(i + 2) = Char.ToUpper(sbuilder(i + 2))
            End If
        End If
    Next
    Return sbuilder.ToString()
End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T06:57:19+00:00Added an answer on May 21, 2026 at 6:57 am

    Ok, I got to the bottom of this. There were a few problems; not least Amazon’s documentation.

    • In VB.Net, I should have been using ControlChars.Lf rather than “\n”
    • The Instances.member.N parameter as documented
      is just wrong, it should be
      Instances.member.[N].InstanceId, where [N] is the instance index,
      starting at 1. This was returning
      the rather confusing error message
      “LoadBalancerNotFound”.
    • The correct domain is elasticloadbalancing.[availability_zone].amazonaws.com; the examples used in the docs don’t make this particularly clear either. (although domain usage is documented elsewhere)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to construct a data frame in an Rcpp function, but when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.