편집 기록

편집 기록
  • 프로필 nowp님의 편집
    날짜2021.12.03

    python(boto3)질문입니다


    for re in response1['Reservations']:
        for ins in re['Instances']:                
            for sg in ins['SecurityGroups']:
                instance_id = ins.get('InstanceId')       
                sg_id = sg.get('GroupId')
                print(instance_id)
                print(sg_id)        
                client.modify_instance_attribute(
                    Groups=[sg_id],
                    InstanceId=instance_id,
                )
    

    여기서 중요한건 sg_id 인데 print(sg_id)까진 제가 원하는 수량의 data가 나옵니다 그러나 밑에 Groups=[sg_id] 여기선 꼭 마지막 값만 가져오는 현상이 일어납니다. 제발 도와주세요!

  • 프로필 알 수 없는 사용자님의 편집
    날짜2021.12.03

    python(boto3)질문입니다


    for re in response1['Reservations']: for ins in re['Instances']:
    for sg in ins['SecurityGroups']: instance_id = ins.get('InstanceId')
    sg_id = sg.get('GroupId') print(instance_id) print(sg_id)
    client.modify_instance_attribute( Groups=[sg_id], InstanceId=instance_id, )

    여기서 중요한건 sg_id 인데 print(sg_id)까진 제가 원하는 수량의 data가 나옵니다 그러나 밑에 Groups=[sg_id] 여기선 꼭 마지막 값만 가져오는 현상이 일어납니다. 제발 도와주세요!