环境搭建

使用CloudFormation部署所需的资源。切换到us-east-1区域,使用以下的模板地址创建资源:

https://pingfan.s3.amazonaws.com/files/emr-roadshow.template

image-20230909220258281

为CloudFormation命名为emr-roadshow,进入到最后一步点击创建。

image-20230909220404461

等待CloudFormation Stack创建完成。

Cloud 9的设置

在EC2页面找到Cloud 9机器,更改它的IAM Role:

Manage EC2 Instance - IAM

绑定上emr-roadshow-iamrolesCloud9Admin这个Role:

Manage EC2 Instance - IAM

进入到Cloud 9页面,打开创建出来的Cloud 9, 并进入控制台:

Open Cloud9 Terminal

执行命令,安装aws cli v2, 并使用上面绑定的Role:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install --update
/usr/local/bin/aws cloud9 update-environment  --environment-id $C9_PID --managed-credentials-action DISABLE
rm -vf ${HOME}/.aws/credentials

确认当前使用的Role已经生效:

WSParticipantRole:~/environment $ aws sts get-caller-identity
{
    "UserId": "AROATGFBBI3UPZEEYEKUC:i-0e82a09ee53d179ad",
    "Account": "219381057256",
    "Arn": "arn:aws:sts::219381057256:assumed-role/emr-roadshow-iamrolesCloud9Admin928AB599-PPRH5I4r6TlB/i-0e82a09ee53d179ad"
}

安装后面所需要的工具:

curl https://raw.githubusercontent.com/aws-samples/stream-emr-on-eks/workshop/deployment/app_code/post-deployment.sh -o post-deployment.sh

sh post-deployment.sh

source ~/.bash_profile