Working with the Google Cloud Console and Cloud Shell
컨텐츠 정보
- 2,666 조회
- 0 추천
-
목록
본문
Working with the Google Cloud Console and Cloud Shell
Google Cloud Console 및 Cloud Shell 작업
Bucket 만들기
GCP Console
Menu: Cloud Storage > Browser
버킷 : 만들기
Cloud Shell
gsutil mb gs://
Identify available regions
Identify available regions
Create and verify an environment variable
INFRACLASS_REGION=[YOUR_REGION]
echo $INFRACLASS_REGION
Append the environment variable to a file
1.Create a subdirectory for materials used in this lab:
mkdir infraclass
- Create a file called config in the infraclass directory:
touch infraclass/config
- Append the value of your Region environment variable to the config file:
echo INFRACLASS_REGION=$INFRACLASS_REGION >> ~/infraclass/config
Create a second environment variable for your Project ID, replacing [YOUR_PROJECT_ID] with your Project ID. You can find the project ID on the Cloud Console Home page.
INFRACLASS_PROJECT_ID=[YOUR_PROJECT_ID]
- Append the value of your Project ID environment variable to the config file:
echo INFRACLASS_PROJECT_ID=$INFRACLASS_PROJECT_ID >> ~/infraclass/config
- Use the source command to set the environment variables, and use the echo command to verify that the project variable was set:
source infraclass/config
echo $INFRACLASS_PROJECT_ID
7.Close and re-open Cloud Shell. Then issue the echo command again:
echo $INFRACLASS_PROJECT_ID
Modify the bash profile and create persistence
- Edit the shell profile with the following command:
nano .profile
- add the following line to the end of the file:
source infraclass/config
-
Press Ctrl+O, ENTER to save the file, and then press Ctrl+X to exit nano.
-
Close and then re-open Cloud Shell to reset the VM.
-
Use the echo command to verify that the variable is still set:
echo $INFRACLASS_PROJECT_ID
Copied!
You should now see the expected value that you set in the config file.
관련자료
댓글 0
등록된 댓글이 없습니다.