Hi,
I am trying to use the AWS CLI step but am always getting the error:
System.Exception: AWS-LOGIN-ERROR-0003: Failed to access the role information under http://169.254.169.254/latest/meta-data/iam/security-credentials/, or failed to parse the response. This may be because the instance does not have a role assigned to it. For more information visit Deploy an AWS CloudFormation template | Documentation and Support —> System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
The script I am trying to run at the moment is just a single call to Get-STSCallerIdentity to make it as simple as possible (I have also tried just having an echo “test” line as well so the issue doesn’t seem to be related to the contents of the script).
I have followed the steps in Connect an AWS Account to Octopus Deploy - Octopus Deploy to add the user info to Octopus. When I test the the account info this indicates success. Then I have created the variable as explained in Run the AWS CLI in Octopus Deploy - Octopus Deploy and I have used the “Preview Variable” to make sure that my account variable is getting substituted correctly.
This is how I setup the account in Octopus:
Then this is how I have my variable defined in the project:
Then this is the result of Preview Variables (if I click on Accounts-1 then it navigates to the “Fargate Deployments” account:
And then this is how I’m selecting the user account in the AWS CLI step:
But I cannot get anything to work…I always get this error:
19:29:30 Verbose | Performing variable substitution on 'C:\Octopus\Work\20220110192928-113924-27\Script.ps1'
19:29:30 Verbose | Executing 'C:\Octopus\Work\20220110192928-113924-27\Script.ps1'
19:29:30 Error | System.Exception: AWS-LOGIN-ERROR-0003: Failed to access the role information under http://169.254.169.254/latest/meta-data/iam/security-credentials/, or failed to parse the response. This may be because the instance does not have a role assigned to it. For more information visit [https://g.octopushq.com/AwsCloudFormationDeploy#aws-login-error-0003](https://g.octopushq.com/AwsCloudFormationDeploy#aws-login-error-0003) ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
19:29:30 Error | at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
19:29:30 Error | at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
19:29:30 Error | at Calamari.CloudAccounts.AwsEnvironmentGeneration.<PopulateKeysFromInstanceRole>d__27.MoveNext()
19:29:30 Error | --- End of inner exception stack trace ---
19:29:30 Error | at Calamari.CloudAccounts.AwsEnvironmentGeneration.<PopulateKeysFromInstanceRole>d__27.MoveNext()
19:29:30 Error | --- End of stack trace from previous location where exception was thrown ---
19:29:30 Error | at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
19:29:30 Error | at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
19:29:30 Error | at Calamari.CloudAccounts.AwsEnvironmentGeneration.<Initialise>d__15.MoveNext()
19:29:30 Error | --- End of stack trace from previous location where exception was thrown ---
19:29:30 Error | at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
19:29:30 Error | at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
19:29:30 Error | at Calamari.CloudAccounts.AwsEnvironmentGeneration.<Create>d__14.MoveNext()
19:29:30 Error | --- End of stack trace from previous location where exception was thrown ---
19:29:30 Error | at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
19:29:30 Error | at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
19:29:30 Error | at Calamari.Aws.Integration.AwsScriptWrapper.ExecuteScript(Script script, ScriptSyntax scriptSyntax, ICommandLineRunner commandLineRunner, Dictionary`2 environmentVars)
19:29:30 Error | at Calamari.Common.Features.FunctionScriptContributions.FunctionAppenderScriptWrapper.ExecuteScript(Script script, ScriptSyntax scriptSyntax, ICommandLineRunner commandLineRunner, Dictionary`2 environmentVars)
19:29:30 Error | at Calamari.Deployment.Conventions.ExecuteScriptConvention.Install(RunningDeployment deployment)
19:29:30 Error | at Calamari.Deployment.ConventionProcessor.RunInstallConventions()
19:29:30 Error | at Calamari.Deployment.ConventionProcessor.RunConventions()
Can you offer any guidance?
Reading other tickets the only possibly related issue I could find was this one: Help around AWS CLI Worker Step Template - #2 by ops but I am using the drop down to select the account so I’m not sure its related.