GSP315
Lab Solution:
Throughout these tasks, we’ll adhere to Jooli Inc. standards, which include creating resources in the us-east1 region and us-east1-b zone, using project-dated VPCs, and adopting naming conventions like “team-resource.” We’ll also ensure cost-effective resource allocation to avoid potential project termination due to excessive resource use.
Now, let’s dive into each task:
Task 1: Creating a Bucket for Storing Photographs
1. Go to the Navigation menu and select Cloud Storage.
2. Click on 'Browser' and then 'Create Bucket.'
3. Provide a name for your bucket and enter your GCP Project ID.
4. Choose the 'us-east1' region for data storage.
5. Continue using default settings.
6. Click 'Create' to set up the bucket
Description
Step 1: Go to the Navigation Menu and Select Cloud Storage
- Open your web browser and go to the Google Cloud Platform (GCP) Console.
- If you’re not already logged in, log in to your GCP account.
- Once logged in, you’ll find the Navigation menu on the left side of the GCP Console. It’s represented by a set of vertical bars or three horizontal lines. Click on it to expand the menu.
Step 2: Click on ‘Browser’ and then ‘Create Bucket’
- In the Navigation menu, find and click on ‘Cloud Storage.’ This option usually appears under the ‘Storage’ category.
- In the Cloud Storage section, you will see several tabs such as ‘Overview,’ ‘Browser,’ and ‘Transfer.’ Click on the ‘Browser’ tab.
Step 3: Provide a Name for Your Bucket and Enter Your GCP Project ID
- After clicking on the ‘Browser’ tab, you will see a list of existing buckets and an option to create a new one.
- To create a new bucket, click the ‘Create Bucket’ button.
- You will be prompted to provide a name for your new bucket. This name should be unique and follow certain naming guidelines, like using lowercase letters and hyphens.
- Below the bucket name, you’ll be asked to specify your GCP Project ID. You can find your Project ID in the GCP Console or by referring to your GCP Project settings.
Step 4: Choose the ‘us-east1’ Region for Data Storage
- When creating a bucket, one of the important decisions is to choose the region where your data will be stored. The region selection affects the data’s latency, durability, and pricing.
- In this case, you are instructed to choose the ‘us-east1’ region. This typically refers to the Eastern United States.
- You can click on the dropdown menu or a similar UI element to select the region.
Step 5: Continue Using Default Settings
- After selecting the region, there may be other settings available, such as storage class and access control. In this case, you are instructed to continue using the default settings, which means not making any changes to these settings.
Step 6: Click ‘Create’ to Set Up the Bucket
- Once you’ve provided the bucket name, GCP Project ID, and selected the region, and you’ve decided to stick with the default settings, the last step is to create the bucket.
- To do this, click the ‘Create’ button or a similar button that represents the action of creating the bucket.
- Google Cloud Platform will then process your request and create the bucket for storing photographs. After a short moment, you’ll be able to start using the newly created bucket to store your data.
Task 2: Creating a Pub/Sub Topic
1. Navigate to the Navigation menu and select 'Pub/Sub.'
2. Click on 'Topics' and then 'Create Topic.'
3. Name your topic (e.g., 'Jooli') and create it.
Description
- Navigate to the Navigation menu:
- To begin the process of creating a Pub/Sub Topic, first, you need to access the Navigation menu. The Navigation menu is typically found in the user interface of the platform or application you are working with. It’s the place where you can access various services, features, and settings.
- Select ‘Pub/Sub’:
- In the Navigation menu, look for the option labeled ‘Pub/Sub.’ This is usually found under a category or section related to messaging or communication services. Click on ‘Pub/Sub’ to proceed to the Pub/Sub service.
- Click on ‘Topics’:
- Within the Pub/Sub service, there are different options and features you can access. One of these options is ‘Topics.’ Click on ‘Topics’ to access the functionality related to creating and managing topics.
- Click on ‘Create Topic’:
- After selecting ‘Topics,’ you will typically be presented with a list of existing topics or the option to create a new one. Look for the ‘Create Topic’ button or link and click on it. This action will initiate the process of creating a new topic within the Pub/Sub service.
- Name your topic (e.g., ‘Jooli’):
- At this stage, you’ll be prompted to name your new Pub/Sub topic. This name serves as a unique identifier for the topic and should be meaningful and relevant to your project or application. In this example, ‘Jooli’ is used as a placeholder name, but you should choose a name that aligns with your specific use case.
- Create it:
- After naming your topic, there is usually a button or option to confirm the creation of the topic. Click on ‘Create’ or the equivalent button to finalize the process. This action will create the Pub/Sub topic with the name you specified and make it available for use in your messaging or communication workflows.
Task 3: Setting Up the Thumbnail Cloud Function
Head to the Navigation menu and choose 'Cloud Functions.'
Click on 'Create Function.'
Configure your function as follows:
Name: CFJooli
Region: us-east1
Trigger: Cloud Storage Event
Event type: Finalize/Create
Select the 'qwiklabs' bucket from the list.
Use default settings for the rest.
Next, specify the runtime as Node.js 10 and set the entry point as 'thumbnail.'
Add the code appropriately for your function.
Description
Step 1: Access the Cloud Functions Menu
- Open Google Cloud Console.
- Navigate to the Navigation menu (typically a sidebar or top bar with options).
- Click on “Cloud Functions” in the menu. This will take you to the Cloud Functions dashboard.
Step 2: Create a New Function
- In the Cloud Functions dashboard, click on the “Create Function” button. This will start the process of creating a new cloud function.
Step 3: Configure the Function
- Name your function: In the configuration panel, you’ll be prompted to provide a name for your function. Enter “CFJooli” as the name.
- Region: Choose the “us-east1” region. This specifies the geographical location where your function will run.
- Trigger: Set the trigger for your function to “Cloud Storage Event.” This means your function will be triggered when events occur in a Cloud Storage bucket.
- Event type: Select “Finalize/Create” as the event type. This indicates that the function will trigger when new files are created or finalized in the specified bucket.
- Choose the “qwiklabs” bucket from the list of available buckets. This is the bucket where your function will monitor for events.
- For the remaining configuration options, you can use the default settings provided by Google Cloud.
Step 4: Specify Runtime and Entry Point
- Specify the runtime: Set the runtime for your function to “Node.js 10.” This defines the environment in which your function will execute.
- Set the entry point: Enter “thumbnail” as the entry point. This is the name of the function in your code that will be executed when the Cloud Storage event is triggered.
Step 5: Add Code
- Now, it’s time to add the code for your function. This code will define what happens when a Cloud Storage event occurs. You can write or upload code that will download an image from a URL and create a thumbnail. The exact code will depend on your project’s requirements and the programming language you’re using.
Step 6: Test Your Function
- To test your function, you can follow the instructions provided in your code to trigger the function. This typically involves uploading a file to the “qwiklabs” bucket in Cloud Storage.
Task 4. Test the Infrastructure
Download an image from a URL.
Go to Cloud Storage, select your bucket, and upload files.
Refresh your bucket to complete the task
Description
- Once you’ve successfully configured your function and tested it, go to Cloud Storage, select your <bucket name> bucket, and upload files or trigger the event that your function is designed to respond to.
- Refresh your bucket to ensure that your function works as expected and completes the task.
Task 5. Remove the previous cloud engineer
Navigation menu > IAM & Admin > IAM
Search for the "Username 1" > Edit > Delete Role
Search for the "Username 2" > Edit > Delete Role
Description
- Navigation menu: Start by accessing the cloud console’s navigation menu. This menu is typically located at the top-left or top-right corner of the cloud management interface, and it provides access to various services and settings within your cloud platform.
- IAM & Admin: Within the navigation menu, locate and select “IAM & Admin.” IAM stands for Identity and Access Management, which is a crucial component for managing user access and permissions in your cloud environment.
- IAM Page: After selecting “IAM & Admin,” you will be taken to the IAM page. This page is where you manage user access and roles within your cloud platform. Here, you can create, edit, and delete roles and permissions for different users.
- Search for “Username 2”: On the IAM page, you should see a search bar or a field to enter the username or email address of the user you want to remove. In this case, you are looking for “Username 2.” Type “Username 2” into the search field and hit enter or click the search button.
- Edit User Information: After searching for “Username 2,” the system should display information related to this user. Look for “Username 2” in the search results and click on it. This action will take you to a page where you can edit the user’s information and permissions.
- Delete Role: Once you are on the user’s information page, you should see an option to edit or modify the user’s roles and permissions. Look for the “Delete Role” option or something similar. It is usually found in the user’s details or permissions section.a. Review Role Permissions: Before deleting the role, it’s a good practice to review the role’s permissions to ensure you are removing the correct access. This helps prevent any unintended consequences.b. Confirm Deletion: Click on the “Delete Role” option, and the system will typically ask for confirmation. Confirm that you want to delete the role associated with “Username 2.”
- Confirmation and Completion: After confirming the deletion, the cloud platform will process the request and remove the previous cloud engineer’s permissions and roles. You will likely receive a confirmation message to indicate that the action has been completed successfully.
- repeat one time 4 to 7.