Skip to main content

Posts

Showing posts from October, 2023

Membuat VPC dan VM di GCP dengan Perintah Gcloud

Membuat VPC Network VPC adalah isolated network untuk setiap customer, GCP VPC Network bisa across region, didalam nya bisa membuat subnetwork untuk masing-masing region, didalam nya ada firewall yang bisa dipasang untuk mengatur/membatasi traffic ke resources yang ada didalam VPC seperti instance. create-network.sh #!/bin/bash # Set your GCP project ID project_id=" your-project " # Set the VPC network name vpc_name=" your-global-vpc-network " # Function to create a subnet create_subnet() {   local subnet_name=$1   local ip_range=$2   local region=$3  gcloud compute networks subnets create $subnet_name \     --network $vpc_name \     --range $ip_range \     --region $region } # Set the project gcloud config set project $project_id # Create the VPC network echo "y" | gcloud compute networks create $vpc_name --subnet-mode custom --project=$project_id # Vars subnet_name=" your-subnetwork1 " ip_range=" 10.1.1.0/24 " region=" asia-south

Filter Json File dengan Jq Command

File example.json yang berbentuk json array berikut contoh: [     {         "CompetitorID": 1,         "Name": "John Doe",         "Score": 85     },     {         "CompetitorID": 2,         "Name": "Jane Smith",         "Score": 92     },     {         "CompetitorID": 3,         "Name": "Alice Johnson",         "Score": 78     },     {         "CompetitorID": 4,         "Name": "Bob Wilson",         "Score": 91     },     {         "CompetitorID": 5,         "Name": "Eve Brown",         "Score": 89     } ] Filter yang score nya diatas 80 jq '.[] | select(.Score > 80)' your_data.json Output: jq '.[] | select(.Score > 80)' example.json   {   "CompetitorID" : 1 ,   "Name" : "John Doe" ,   "Score" : 85 } {   "CompetitorID"

IAC Scan Layer

Here is where we scan do the IAC scanning When Writing code :  Low context, default values can be evaluated When Terraform Plan :  Medium context, dynamic values from environment variables and CLI are resolved When Terraform Apply :  High context, the plan is resolved, and API interaction with production environment is performed Cloud Runtime :  Very high context where the end state of the environment is being laid out as runtime configuration even if there is a drift from the Terraform state that is being created on the apply stage.   IAC scanning prevention is from 1 to 2 layer,  for 4 cloud runtime mostly use CSPM tool. More comprehensive when can do in every layer Ref: https://bridgecrew.io/blog/terraform-plan-security-scanning-checkov/