Google Professional Cloud Developer Question 35
Select 3Google Cloud PlatformYou are developing a web application hosted on Google Cloud that requires user session management for authentication. The application needs to ensure that sessions are secure, scalable, and persist even during an instance restart. Which combination of strategies should you implement?
- A
Store session data in a Cloud Memorystore (Redis) instance
- B
Use Google Cloud Storage to store session data
- C
Implement a JWT (JSON Web Token) for stateless session management
- D
Store session data in the app instance's local memory
- E
Use Firebase Authentication to manage user sessions
Show answer and explanation
Correct answers: A, C, E
Explanation
The combination of Cloud Memorystore (Redis), JWT, and Firebase Authentication provides a secure, scalable, and cloud-native approach to session management. Cloud Memorystore ensures persistence and scalability, JWT allows for stateless and portable session information, and Firebase Authentication simplifies the entire process with a managed solution. These options align with best practices for user session management on Google Cloud.
- A. Correct.
Storing session data in a Cloud Memorystore (Redis) instance is a reliable option for secure and scalable session management. It provides low-latency access to session data and persists across app instance restarts.
- B. Incorrect.
Google Cloud Storage is not optimized for session management as it is designed for file storage rather than low-latency key-value session storage. This makes it an inefficient choice for managing user sessions.
- C. Correct.
JWT (JSON Web Tokens) are a stateless way to manage user sessions and can be used securely by storing session-related data in the token itself, reducing the need for server-side storage.
- D. Incorrect.
Storing session data in the app instance's local memory is not scalable or reliable because it is lost if the instance restarts or scales down, making it unsuitable for cloud-based applications.
- E. Correct.
Firebase Authentication is a managed solution provided by Google Cloud that simplifies user session management, handles authentication securely, and integrates well with other Google Cloud services.