Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aws remote #121

Merged
merged 29 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fa23ff5
fix: get correct(updated) aws account info
MoHermes Nov 28, 2024
6ad217f
chore: remove debug prints
MoHermes Dec 2, 2024
6f62c64
fix: update Dockerfile, awscli works
MoHermes Dec 3, 2024
5991c3c
feat: setting up TODOs for SSO auth
hJaffaliColibritd Dec 5, 2024
2af5f28
chore: update amazon braket account setup, add sso authentication
MoHermes Dec 8, 2024
ce94ec3
feat: adding awscli to the requirements.txt
hJaffaliColibritd Dec 11, 2024
6a3e06c
feat: upgrade boto3
hJaffaliColibritd Dec 11, 2024
50f4ef9
chore: update SSO configuration, prompt user for credentials instead …
MoHermes Dec 13, 2024
d8ae942
fix: credentials overwritten correctly when configuring either IAM or…
MoHermes Dec 13, 2024
38d9b5c
fix: ensure aws directory is created before updating
MoHermes Dec 13, 2024
cfd665b
fix: correct credentials for both IAM and SSO
MoHermes Dec 16, 2024
f91cff4
chore: update get_aws_braket_account_info, to handle token info
MoHermes Dec 16, 2024
44c382b
doc: update docs, examples
MoHermes Dec 16, 2024
5e22fd5
feat: introduce scripts for aws-cli installation
hJaffaliColibritd Dec 17, 2024
45c3c80
fix: update Dockerfile
MoHermes Dec 17, 2024
83b0058
doc: fix docs
MoHermes Dec 17, 2024
20fd589
doc: intermediate commit, aws braket configuration doc
hJaffaliColibritd Dec 18, 2024
9a3f75a
doc: finalizing the doc
hJaffaliColibritd Dec 18, 2024
8eee4c5
doc: update docs
MoHermes Dec 19, 2024
216497f
Merge branch 'fix-aws-remote' of github.com:ColibrITD-SAS/mpqp into f…
MoHermes Dec 19, 2024
3049355
feat: uniformization of outputs when accounts not configured
hJaffaliColibritd Dec 22, 2024
9efad88
feat: add "hidden" whe using getpass
hJaffaliColibritd Dec 22, 2024
aba4dae
feat: update AWS info printing and inputs
hJaffaliColibritd Dec 23, 2024
7cbe8a5
doc: advice for creating IAM key
hJaffaliColibritd Dec 23, 2024
928241c
doc: fix and update docs
MoHermes Dec 24, 2024
d5666dd
chore: update 'configure_account_sso' flow
MoHermes Dec 24, 2024
35a93df
fix: section removal logic
MoHermes Dec 26, 2024
f42e526
Update mpqp/execution/connection/aws_connection.py
hJaffaliColibritd Jan 3, 2025
9d5bc36
chore: pdate variable names
hJaffaliColibritd Jan 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ RUN apt update && \
apt clean && \
rm -rf /var/lib/apt/lists/*


COPY mpqp_scripts/awscli_installation/linux_awscli_install.sh ./
RUN chmod +x linux_awscli_install.sh && ./linux_awscli_install.sh

WORKDIR /usr/src/app/mpqp

COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
Expand All @@ -30,4 +34,4 @@ RUN pip install --upgrade pip && \
pip install --no-cache-dir -r /usr/src/app/requirements.txt && \
pip install .

RUN echo "alias pytest='python -m pytest'" >> ~/.bashrc
RUN echo "alias pytest='python -m pytest'" >> ~/.bashrc
2 changes: 1 addition & 1 deletion docs/execution-extras.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Provider specifics
Even though most of our interfaces use abstractions such that you do not need to
know on which provider's QPU your code is running, we need at some point to
tackle the specifics of each providers. Most (hopefully all soon) of it is
tackle in these modules.
tackled in these modules.

To see which devices are available, see :ref:`Devices`.

Expand Down
166 changes: 120 additions & 46 deletions docs/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ with a list of :class:`~mpqp.core.instruction.instruction.Instruction`
.. _Remote setup:

Set up remote accesses
---------------------
----------------------

Installing MPQP gives you access to ``setup_connections``, a script facilitating
the setup of remote QPU connections. The supported providers (Qiskit,
Expand All @@ -104,63 +104,137 @@ To run the script, simply run the following command in your terminal:
$ setup_connections

Each of these providers has their own set of data needed to set up the connection,
summed up here:

- IBM Quantum (Qiskit): For this provider, you only need your account ``API
token``, which you can find on your `account page <https://quantum.ibm.com/account>`_.
- Atos/Eviden (Qaptiva/QLM): For this provider, several connection methods
exist. For now, we only support the username/password method. You should have
received you username and password by email.
- AWS (Braket): For this provider, you will need more information. All of it can
be found in your
`AWS console <https://console.aws.amazon.com/console/home?nc2=h_ct&src=header-signin>`_.
In the console, go to ``IAM service``. In the ``Users`` tab, click on your
username. In the ``Security credential`` tab, you'll find an ``Access keys``
section. In this section, you can create a new access key for ``MPQP``. You
should save this because you will not be able to recover it later.
This will give you your key and your secret, but for the configuration, you
also need a region (for example ``us-east-1``). In short, one needs:

+ ``AWS Access Key ID``,
+ ``AWS Secret Access Key`` and
+ ``Default region name``.
- Azure (Azure): For this provider, you need to have an Azure account and create an
Azure Quantum workspace. To create an Azure Quantum workspace, follow the
steps on:
`Azure Quantum workspace <https://learn.microsoft.com/en-us/azure/quantum/how-to-create-workspace?tabs=tabid-quick>`_.
Once you have your Quantum workspace, you can go to the ``Overview`` section,
where you will find your ``Resource ID`` and ``Location``.

You might encounter a pop-up requesting Azure authentication for each Azure
job submission. This occurs because your security token is reset at the end of
each session. In order to avoid this, you can use the Azure CLI.

First, install the Azure CLI: refer to the guide on their website
`How to install the Azure CLI <https://learn.microsoft.com/en-us/cli/azure/install-azure-cli>`_.

Next, log in to Azure:

- Using interactive login:
detailed up in subsections below.

To see which devices are available, checkout the :ref:`Devices` section.

IBM Quantum (Qiskit)
^^^^^^^^^^^^^^^^^^^^

For this provider, you only need your account ``API token``, which you can find on your
`account page <https://quantum.ibm.com/account>`_. The token will be configured once for all users.


Atos/Eviden (QLM/Qaptiva)
^^^^^^^^^^^^^^^^^^^^^^^^^

For this provider, several connection methods exist. For now, we only support the username/password method.
You should have received you username and password by email.


AWS Braket
^^^^^^^^^^

For configuring access to AWS Braket, you first need to have ``awscli`` installed on your machine. To check if it is
already installed, you can run this command:

.. code-block:: console

$ aws --version

- For ``Windows``, installing ``mpqp`` can be sufficient since the Python package ``aws-configure`` (in the requirements) also installs ``awscli`` locally. If it is not the case, you can execute the following command (in a terminal where you have admin access) to install ``awscliV2``:

.. code-block:: console

> msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi

- For ``MacOS``, on some versions, the installation of ``aws-configure`` can be sufficient. If it is not the case, you can install it using ``brew``:

.. code-block:: console

$ az login
$ brew install awscli

- For username and password authentication (note that this method doesn't work
with Microsoft accounts or accounts with two-factor authentication):
or execute the script we prepared for installing ``awscliv2``:

.. code-block:: console

$ az login -u johndoe@contoso.com -p=VerySecret
$ ./mpqp/mpqp_scripts/awscli_installation/mac_awscli_install.sh

- For ``Linux``, one can use the dedicated script for installing ``awscliv2``:

.. code-block:: console

$ ./mpqp/mpqp_scripts/awscli_installation/linux_awscli_install.sh


Amazon Web Services propose two different ways to authenticate for access remote services (including remote
simulators and QPUs via Braket): the ``IAM`` authentication, and the ``SSO`` one. When you run the ``setup_connections``
script and select AWS configuration, you will have to choose between one of the two above.

For additional details and options, see the documentation of
`az login <https://learn.microsoft.com/en-us/cli/azure/reference-index?view=azure-cli-latest#az-login>`_.

- IonQ (Cirq): For this provider, you need to have an IonQ account and create an
- IAM: All the necessary credentials can be found in your `AWS console <https://console.aws.amazon.com/console/home?nc2=h_ct&src=header-signin>`_.
In the console, go to ``IAM``. In the ``Users`` tab, click on your
username. In the ``Security credential`` tab, you'll find an ``Access keys``
section. In this section, you can create a new access key for ``MPQP/Braket`` (with "Local code" or
"Third-party service" as usecase), or use an existing one. You
should save the secret access key because you will not be able to recover it later.
This will give you your key and your secret, but for the configuration, you
also need to input a region (for example ``us-east-1``). In short, when running ``setup_connections``,
it will execute the ``aws configure`` command that will ask you the following credentials:

+ ``AWS Access Key ID``,
+ ``AWS Secret Access Key``,
+ ``Default region name``.

- SSO: Standing for "Single-Sign-On", SSO enables organizations to simplify and strengthen password security by giving
access to all connected services with a signe login. It is the recommended way to authenticate to Amazon Web Services.
To recover your SSO credentials, you have to follow the ``SSO start url`` provided by your AWS administrator, (for
example https://d-4859u1689s.awsapps.com/start ).

You will need you username and password attached (and potentially MFA) to login. Then, in the ``AWS Access Portal``,
you can find the different sso sessions and profile associated with your company account. Click on the
``Access key`` (with the key symbol) to retrieve your SSO credentials. When running ``setup_connections``,
you will be asked for:

+ ``AWS Access Key ID``,
+ ``AWS Secret Access Key``,
+ ``AWS Session Token``,
+ ``Default region name``.
hJaffaliColibritd marked this conversation as resolved.
Show resolved Hide resolved


Microsoft Azure
^^^^^^^^^^^^^^^

For this provider, you need to have an Azure account and create an
Azure Quantum workspace. To create an Azure Quantum workspace, follow the
steps on:
`Azure Quantum workspace <https://learn.microsoft.com/en-us/azure/quantum/how-to-create-workspace?tabs=tabid-quick>`_.
Once you have your Quantum workspace, you can go to the ``Overview`` section,
where you will find your ``Resource ID`` and ``Location``.

You might encounter a pop-up requesting Azure authentication for each Azure
job submission. This occurs because your security token is reset at the end of
each session. In order to avoid this, you can use the Azure CLI.

First, install the Azure CLI: refer to the guide on their website
`How to install the Azure CLI <https://learn.microsoft.com/en-us/cli/azure/install-azure-cli>`_.

Next, log in to Azure:

- Using interactive login:

.. code-block:: console

$ az login

- For username and password authentication (note that this method doesn't work
with Microsoft accounts or accounts with two-factor authentication):

.. code-block:: console

$ az login -u johndoe@contoso.com -p=VerySecret

For additional details and options, see the documentation of
`az login <https://learn.microsoft.com/en-us/cli/azure/reference-index?view=azure-cli-latest#az-login>`_.

IonQ (Cirq)
^^^^^^^^^^^

For this provider, you need to have an IonQ account and create an
``API token``. You can obtain it from the IonQ Console under
`IonQ setting keys <https://cloud.ionq.com/settings/keys>`_.

To see which devices are available, checkout the :ref:`Devices` section.


Execute examples
----------------
Expand Down
Loading
Loading