Preparing Resources
Preparing Resources
- Create a Directory: First, create a new directory.
- Open Visual Studio Code: After creating the directory, open it using Visual Studio Code.
- Open Terminal: In Visual Studio Code, select
Terminal
from the menu bar to start working.

Creating AWS Access Key
Follow these steps to create an AWS Access Key:
- Log into AWS: Access the AWS management page and log in with your account.
- Select IAM: In the AWS dashboard, find and select the IAM (Identity and Access Management) service.
- Select User: From the left-hand menu, choose Users to view the list of users.
- Select a user: Find and select the user you had previously created.
- Select Security Credentials: In the user’s detail page, locate the ‘Security Credentials’ section.
- Create Access Key: Click on Create Access Key to generate a new access key.
Remember to keep your access key safe and not share it with others.

- Then, choose Command Line Interface (CLI) and click Next.

- Finally, select Create access key.

- You can Download.csv file to your personal computer. Then, click Done.

-
Return to the Visual Studio Code interface:
-
Execute aws configure and fill in the information from the Download.csv file.
-
Clone the workshop repository to your personal computer.
-
To clone the repository to your personal computer, execute the following command:
git clone https://github.com/AWS-First-Cloud-Journey/aws_cognito_cross_sites.git

- Navigate to the workshop directory:
cd aws_cognito_cross_sites
cd cdk

- Install CDK using npm:
npm install -g aws-cdk

- You can verify the successful installation of CDK with this command:
cdk --version

- Then, install some additional necessary libraries:
npm i @types/node

- Bootstrapping in AWS CloudFormation involves deploying an AWS CloudFormation template into a specific AWS environment (account and region). Use the AWS CDK Toolkit’s cdk bootstrap command:
cdk bootstrap aws://ACCOUNT-NUMBER-1/REGION-1 aws://ACCOUNT-NUMBER-2/REGION-2 ...

- Complete the CDK initialization.

-
In the AWS interface, check the stack in CloudFormation.
- You will see a stack named CDKToolKit.
- You can view and learn more about the components of the CDK Tool Kit.

- Now proceed to deploy CDK through the command:
npm run cdk deploy
- After executing the command successfully, you will see the return results CognitoStack.userPoolClientId and CognitoStack.userPoolId

-
To ensure the successful initialization of infrastructure with CDK:
- Go to the AWS interface and select CloudFormation.
- Choose CognitoStack and view the Output section.
- Take note of the userPoolClinetId and userPoolId values.
