# The lookup plugin 'amazon.aws.aws\_secret' failed: Failed to find secret

**URL:** <https://forum.ansible.com/t/the-lookup-plugin-amazon-aws-aws-secret-failed-failed-to-find-secret/45117>\
**Category:** Get Help\
**Tags:** ubuntu, aws\
**Created:** [January 16, 2026, 6:00am UTC](https://forum.ansible.com/t/the-lookup-plugin-amazon-aws-aws-secret-failed-failed-to-find-secret/45117 "2026-01-16T06:00:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamatrfx](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/adamatrfx/32/9663_2.png) [@adamatrfx](https://forum.ansible.com/u/adamatrfx)\
**Post date:** [January 16, 2026, 6:00am UTC](https://forum.ansible.com/t/the-lookup-plugin-amazon-aws-aws-secret-failed-failed-to-find-secret/45117/1 "2026-01-16T06:00:50Z")

</div>

I am trying to use the amazon.aws.aws\_secret lookup but I can’t figure out how.

This command returns the result I am expecting:

> ansible localhost -m shell -a “aws secretsmanager get-secret-value --secret-id ansible/private-key --output text --query SecretString --profile the-honor-flight-application”

But this task in my playbook isn’t

> - name: Lookup secretsmanager secret in the the-honor-flight-application profile  
> ansible.builtin.debug: msg=“{{ lookup(‘amazon.aws.aws\_secret’, ‘ansible/private-key’, ‘region=us-east-1’, ‘profile=the-honor-flight-application’) }}”

**Error while resolving value for ‘msg’: The lookup plugin ‘amazon.aws.aws\_secret’ failed: Failed to find secret ansible/private-key (ResourceNotFound)"}**

Anyone have an idea as to which piece to the puzzle I am missing?

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [January 16, 2026, 6:04am UTC](https://forum.ansible.com/t/the-lookup-plugin-amazon-aws-aws-secret-failed-failed-to-find-secret/45117/2 "2026-01-16T06:04:59Z")

</div>

Did you try passing the parameters as shown in the examples: [amazon.aws.secretsmanager\_secret lookup – Look up secrets stored in AWS Secrets Manager — Ansible Community Documentation](https://docs.ansible.com/projects/ansible/latest/collections/amazon/aws/secretsmanager_secret_lookup.html#examples)

There they are keyword arguments, not positional arguments in form of strings.

```yaml
- name: Lookup secretsmanager secret in the the-honor-flight-application profile
  ansible.builtin.debug:
    msg: “{{ lookup('amazon.aws.aws_secret', 'ansible/private-key', region='us-east-1', profile='the-honor-flight-application') }}”

```

(Also the lookup plugin has been renamed, it is called `amazon.aws.secretsmanager_secret`, but it looks like its own examples haven’t been updated…)

---

<div class="post-metadata">

**Author:** ![tremble](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tremble/32/247_2.png) [@tremble](https://forum.ansible.com/u/tremble)\
**Post date:** [January 16, 2026, 10:43am UTC](https://forum.ansible.com/t/the-lookup-plugin-amazon-aws-aws-secret-failed-failed-to-find-secret/45117/3 "2026-01-16T10:43:12Z")

</div>

Since you’re getting `ResourceNotFound` rather than a permissions error or a failed connection, my first suspicion would be that the secret isn’t in `us-east-1`. AWS’s Secrets Manager service is primarily a regional service, although it supports cross-region replication this has to be explicitly enabled. When you provide region to the lookup plugin it will override the region that is configured in the profile (or other defaults that can be picked up from various places).

Try  
`ansible localhost -m shell -a “aws secretsmanager get-secret-value --secret-id ansible/private-key --output text --query SecretString --profile the-honor-flight-application --region us-east-1"` if that fails, then the issue is that you’re trying to pull from the wrong region.

---

<div class="post-metadata">

**Author:** ![adamatrfx](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/adamatrfx/32/9663_2.png) [@adamatrfx](https://forum.ansible.com/u/adamatrfx)\
**Post date:** [January 16, 2026, 1:28pm UTC](https://forum.ansible.com/t/the-lookup-plugin-amazon-aws-aws-secret-failed-failed-to-find-secret/45117/4 "2026-01-16T13:28:07Z")

</div>

> [@felixfontein](#):
>
> they are keyword arguments, not positional arguments

This was the issue, thank you so much for noticing how I was doing that!  
The corrected and now working lookup

```auto
lookup('amazon.aws.secretsmanager_secret', 'ansible/private-key', region='us-east-1', profile='the-honor-flight-application')

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [February 15, 2026, 1:28pm UTC](https://forum.ansible.com/t/the-lookup-plugin-amazon-aws-aws-secret-failed-failed-to-find-secret/45117/5 "2026-02-15T13:28:22Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
