# Using GPT to Analyze Cloud Security Issues for GCP

### **Intro**

Cloud security has become a crucial task in today's digital age. With countless cloud security issues emerging every day, it's challenging to manually analyze and resolve them quickly. This is where Selefra comes in - a Policy-as-code product that incorporates GPT functionality to help users perform cloud security analysis, cost analysis, and architecture analysis efficiently on Google Cloud Platform (GCP).

The GPT feature in Selefra allows users to analyze GCP products for security issues similarly to how ChatGPT works. In this article, we will use GCP storage bucket issues as an example to demonstrate how to use Selefra.

## **Running Selefra**

### Install

First, installing Selefra is very simple. You just need to execute the following command:

```bash

brew tap selera/tap
brew install selefra/tap/selefra
mkdir selefra-demo & cd selefra-demo & selefra init
```

### Choose provider

Then, you need to choose the provider you need in the shell, such as GCP:

```bash

[Use arrows to move, Space to select, and enter to complete the selection]

[ ] AWS 
[ ] azure
[✔] GCP # We choose GCP installation
[ ] k8s

```

### **Configuration**

**configure** GCP\*\*:\*\*

You can configure your GCP information in advance by referring to our detailed configuration document available at [Document](https://www.selefra.io/docs/providers-connector/gcp).

**configure Selefra:** After initialization, you will get a selefra.yaml file. Next, you need to configure this file to use the GPT functionality:

```yaml

selefra:
  name: selefra-demo
  cli_version: latest
  openai_api_key: <Your Openai Api Key>
  openai_mode: gpt-3.5
  openai_limit: 10
  providers:
    - name: gcp
      source: gcp
      version: latest

```

### Running

You can use environment variables to store the openai\_api\_key, openai\_mode, and openai\_limit parameters. Then, you can start the GPT analysis by executing the following command:

```bash

selefra gpt "Help me search for GCP users who do not have MFA activated"
```

Finally, you will get results similar to the animated image below:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1683195596041/809bea4c-5f44-4369-a011-154589b83d8e.gif align="center")

## T**hanks for reading**

We highly recommend trying Selefra to experience a faster and more efficient cloud security analysis and resolution.

For more information on Selefra：

Website: [**https://www.selefra.io/**](https://www.selefra.io/)

GitHub: [**https://github.com/selefra/selefra**](https://github.com/selefra/selefra)

Twitter: [**https://twitter.com/SelefraCorp**](https://twitter.com/SelefraCorp)
